Skip to content

Commit d01015c

Browse files
authored
Fix release tests (#572)
* Add a auto-loaded global fixture to clear the metaschema cache
1 parent 76b189b commit d01015c

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

conftest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import pytest
2+
import schema_salad.schema
3+
4+
@pytest.fixture(autouse=True, scope='function')
5+
def isolated_cache():
6+
"""A fixture to clear the schema_salad metaschema cache.
7+
8+
Auto-loaded (see autouse) fixture, loaded per test (function scope).
9+
Prevents issues when running multiple tests that load metaschemas
10+
multiple times or in parallel (`pytest-parallel`, `pytest-xdist`, etc).
11+
"""
12+
schema_salad.schema.cached_metaschema = None

schema_salad/tests/test_errors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def test_error_message2() -> None:
7272

7373
t = "test_schema/test2.cwl"
7474
match = r"""
75-
^.+test2\.cwl:2:1: Field `class`\s+contains\s+undefined\s+reference to
75+
^.+test2\.cwl:2:1: Field `class`\s+contains\s+undefined\s+reference\s+to
7676
\s+`file://.+/schema_salad/tests/test_schema/xWorkflow`$"""[
7777
1:
7878
]
@@ -214,7 +214,7 @@ def test_error_message10() -> None:
214214

215215
t = "test_schema/test10.cwl"
216216
match = r"""
217-
^.+test10\.cwl:2:1: Object\s+`.+test10\.cwl`\s+is not valid because
217+
^.+test10\.cwl:2:1: Object\s+`.+test10\.cwl`\s+is\s+not\s+valid\s+because
218218
\s+tried `Workflow`\s+but
219219
.+test10\.cwl:7:1: the `steps`\s+field\s+is\s+not\s+valid\s+because
220220
\s+tried array\s+of\s+<WorkflowStep>\s+but
@@ -240,7 +240,7 @@ def test_error_message11() -> None:
240240
match = r"""
241241
^.+test11\.cwl:7:1: checking field\s+`steps`
242242
.+test11\.cwl:8:3: checking object\s+`.+test11\.cwl#step1`
243-
.+test11\.cwl:9:5: Field `run`\s+contains\s+undefined\s+reference to
243+
.+test11\.cwl:9:5: Field `run`\s+contains\s+undefined\s+reference\s+to
244244
\s+`file://.+/tests/test_schema/blub\.cwl`$"""[
245245
1:
246246
]

0 commit comments

Comments
 (0)