Skip to content

Commit 674c07d

Browse files
committed
Use function-scoped catalog fixture for the test suite
This increases test suite run times substantially, but test independence is more important. Switching from module- to function-scoped exposed an additional test failure relating to marksparkza#65, for example, where the module-scoped catalog had allowed a schema cached in one test to be loaded in the next test, thereby masking an internal error.
1 parent 3598117 commit 674c07d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/test_suite.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@
33

44
import pytest
55

6-
from jschon import Catalog, JSON, JSONSchema, LocalSource, URI
6+
from jschon import JSON, JSONSchema, LocalSource, URI, create_catalog
77
from jschon.utils import json_loadf
88
from tests import metaschema_uri_2019_09, metaschema_uri_2020_12, metaschema_uri_next
99

1010
testsuite_dir = pathlib.Path(__file__).parent / 'JSON-Schema-Test-Suite'
1111

1212

13-
@pytest.fixture(scope='module', autouse=True)
14-
def configure_catalog(catalog: Catalog):
13+
@pytest.fixture(autouse=True)
14+
def catalog():
15+
# replaces the catalog fixture in conftest, for this test module
16+
catalog = create_catalog(
17+
'2019-09',
18+
'2020-12',
19+
'next',
20+
)
1521
catalog.add_uri_source(
1622
URI('http://localhost:1234/'),
1723
LocalSource(testsuite_dir / 'remotes'),

0 commit comments

Comments
 (0)