File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919
2020
2121@pytest .fixture
22- def reference_schema () -> Mapping [str , Any ]:
23- repo = git .Repo (TOP )
24- relative_path_to_schema = DOCS_SCHEMA_LOCATION .relative_to (TOP )
25- raw_yaml = repo .git .show (f"{ MAIN } :{ relative_path_to_schema } " )
26- return yaml .safe_load (raw_yaml )
22+ def reference_schema () -> Mapping [str , Any ] | None :
23+ try :
24+ repo = git .Repo (TOP )
25+ relative_path_to_schema = DOCS_SCHEMA_LOCATION .relative_to (TOP )
26+ raw_yaml = repo .git .show (f"{ MAIN } :{ relative_path_to_schema } " )
27+ return yaml .safe_load (raw_yaml )
28+ except git .exc .GitCommandError :
29+ return None
2730
2831
2932@mock .patch ("blueapi.service.openapi.get_app" )
@@ -77,7 +80,10 @@ def test_schema_updated() -> None:
7780 reason = "If the schema file does not exist, the test is being run"
7881 " with a non-editable install" ,
7982)
80- def test_schema_version_bump_required (reference_schema : Mapping [str , Any ]) -> None :
83+ def test_schema_version_bump_required (reference_schema : Mapping [str , Any ] | None ):
84+ if reference_schema is None :
85+ pytest .skip ("The reference schema is not available" )
86+ return
8187 current_version = _get_version (generate_schema (), "schema in working tree" )
8288 main_version = _get_version (reference_schema , "schema in main" )
8389 if reference_schema != generate_schema ():
You can’t perform that action at this time.
0 commit comments