Skip to content

Commit

Permalink
Schema validation should use all installed resolvers...
Browse files Browse the repository at this point in the history
Using the resolver of an actual AsdfFile context instead of the default
resolver allows any extensions that were installed as entry points to be
used as part of schema validation.
  • Loading branch information
drdavella committed Dec 1, 2017
1 parent 4e9c6cf commit 0fd07c5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions asdf/tests/test_asdf_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,16 @@ def create_schema_example_id(argval):
generate_example_schemas(),
ids=create_schema_example_id)

@pytest.fixture(scope='module')
def asdf_resolver():
"""Using the resolver of an actual AsdfFile context instead of the default
resolver allows any extensions that were installed as entry points to be
used during the schema validation process.
"""
ctx = asdf.AsdfFile()
return ctx.resolver

def test_validate_schema(schema_path):
def test_validate_schema(schema_path, asdf_resolver):
"""Pytest to check validity of schema file at given path
Parameters:
Expand All @@ -177,7 +185,7 @@ def test_validate_schema(schema_path):
'parametrize' utility in order to account for all schema files.
"""
# Make sure that each schema itself is valid.
schema_tree = schema.load_schema(schema_path, resolve_references=True)
schema_tree = schema.load_schema(schema_path, resolver=asdf_resolver, resolve_references=True)
schema.check_schema(schema_tree)


Expand Down

0 comments on commit 0fd07c5

Please sign in to comment.