-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically register the schema tester pytest plugin #676
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f95539b
Move schema tester into separate module. Register pytest plugin
drdavella 0fb7c3f
Remove schema tester from pytest_plugins in conftest.py
drdavella 2e59e95
Disable schema tester by default. Add config option to enable
drdavella 48f0f0f
Add command line option to enable schema tests
drdavella 9ee91b3
Update schema tester documentation
drdavella a4ae8cd
Update change log
drdavella ec3120f
Enable the schema tests by default for this package
drdavella a05fef8
Move schema tester plugin into top-level package
drdavella c0bb835
Refactor schema tester plugin to avoid circular imports
drdavella 5ee090d
Refactor so AsdfFile is not needed for resolver
drdavella File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from pkg_resources import get_distribution, DistributionNotFound | ||
|
||
try: | ||
version = get_distribution(__package__).version | ||
version = get_distribution('asdf').version | ||
except DistributionNotFound: | ||
# package is not installed | ||
version = "unknown" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ | |
|
||
|
||
pytest_plugins = [ | ||
'asdf.tests.schema_tester', | ||
'astropy.tests.plugins.display' | ||
] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Licensed under a 3-clause BSD style license - see LICENSE.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from asdf import extension | ||
from asdf.tests import CustomTestType | ||
|
||
|
||
class LabelMapperTestType(CustomTestType): | ||
version = '1.0.0' | ||
name = 'transform/label_mapper' | ||
|
||
|
||
class RegionsSelectorTestType(CustomTestType): | ||
version = '1.0.0' | ||
name = 'transform/regions_selector' | ||
|
||
|
||
class TestExtension(extension.BuiltinExtension): | ||
"""This class defines an extension that represents tags whose | ||
implementations current reside in other repositories (such as GWCS) but | ||
whose schemas are defined in ASDF. This provides a workaround for schema | ||
validation testing since we want to pass without warnings, but the fact | ||
that these tag classes are not defined within ASDF means that warnings | ||
occur unless this extension is used. Eventually these schemas may be moved | ||
out of ASDF and into other repositories, or ASDF will potentially provide | ||
abstract base classes for the tag implementations. | ||
""" | ||
@property | ||
def types(self): | ||
return [LabelMapperTestType, RegionsSelectorTestType] | ||
|
||
@property | ||
def tag_mapping(self): | ||
return [('tag:stsci.edu:asdf', | ||
'http://stsci.edu/schemas/asdf{tag_suffix}')] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. This is potentially useful elsewhere to get the full-bells-and-whistles resolver so that we don't have to instantiate a dummy
AsdfFile
object just to get to the resolver.