33from typing import List , Optional
44
55import typer
6+ from marshmallow import missing
67
8+ from bioimageio .spec import load_raw_resource_description
79from bioimageio .spec .shared import yaml
810
911
@@ -20,6 +22,8 @@ def main(
2022 weight_format : Optional [str ] = typer .Argument (..., help = "weight format to test model with." ),
2123 rdf_dirs : List [Path ] = (Path (__file__ ).parent / "../artifacts/static_validation_artifact" ,),
2224 create_env_outcome : str = "success" ,
25+ # rdf_source might assume a resource has been deployed, if not (e.g. in a PR), rdf_source is expected to be invalid.
26+ ignore_rdf_source_field_in_validation : bool = False ,
2327):
2428 if weight_format is None :
2529 # no dynamic tests for non-model resources...
@@ -45,9 +49,14 @@ def main(
4549 summary = test_summary_from_exception ("check for test kwargs" , e )
4650 else :
4751 try :
48- summary = test_resource (rdf_path , weight_format = weight_format , ** test_kwargs )
52+ rd = load_raw_resource_description (rdf_path )
53+ if ignore_rdf_source_field_in_validation :
54+ rd .rdf_source = missing
55+
56+ summary = test_resource (rd , weight_format = weight_format , ** test_kwargs )
4957 except Exception as e :
5058 summary = test_summary_from_exception ("call 'test_resource'" , e )
59+
5160 else :
5261 env_path = dist / "static_validation_artifact" / resource_id / version_id / f"conda_env_{ weight_format } .yaml"
5362 if env_path .exists ():
0 commit comments