Skip to content

Commit

Permalink
Refactor so AsdfFile is not needed for resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
drdavella committed Apr 10, 2019
1 parent 9e96d02 commit 068839a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions asdf/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,10 @@ def reset(self):
self._extension_list = None
self._package_metadata = {}

def resolver(self, uri):
tag_mapping = self.extension_list.tag_mapping
url_mapping = self.extension_list.url_mapping
return url_mapping(tag_mapping(uri))


default_extensions = _DefaultExtensions()
7 changes: 4 additions & 3 deletions pytest_asdf/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ def __init__(self, schema_path, parent):
self.schema_path = schema_path

def runtest(self):
from asdf import AsdfFile, schema
ctx = AsdfFile()
from asdf import schema
from asdf.extension import default_extensions

# Make sure that each schema itself is valid.
schema_tree = schema.load_schema(
self.schema_path, resolver=ctx.resolver, resolve_references=True)
self.schema_path, resolver=default_extensions.resolver,
resolve_references=True)
schema.check_schema(schema_tree)


Expand Down

0 comments on commit 068839a

Please sign in to comment.