-
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
Conversation
Hi there @drdavella 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog. I help make sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃. Everything looks good from my point of view! 👍 If there are any issues with this message, please report them here. |
1 similar comment
Hi there @drdavella 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog. I help make sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃. Everything looks good from my point of view! 👍 If there are any issues with this message, please report them here. |
Codecov Report
@@ Coverage Diff @@
## master #676 +/- ##
=======================================
Coverage 93.34% 93.34%
=======================================
Files 39 39
Lines 4295 4295
=======================================
Hits 4009 4009
Misses 286 286 Continue to review full report at Codecov.
|
Packaging the plugin in this way is proving to be unnecessarily burdensome. The right way to do it would be to move the plugin to another package entirely, but I don't think that's the right way to go. |
Closing since this isn't really worth any more time/effort at the moment. |
Could you clarify what the issue is here with registering the pytest plugin? |
What would be wrong with moving the plugin to another package? In a way you already have a separate package for a sphinx plugin, so why not for a pytest plugin? |
@astrofrog the issues have all been related to using the plugin to test the As for moving the plugin to another package, I think the future maintenance burden would be lower if it remained part of the same repository. However, with the way I have set things up here, the plugin is technically installed as a separate package. |
72468dd
to
068839a
Compare
068839a
to
5ee090d
Compare
Looks like eliminating potentially circular references in the plugin got things working. Thanks @astrofrog for encouraging me to continue! |
def resolver(self, uri): | ||
tag_mapping = self.extension_list.tag_mapping | ||
url_mapping = self.extension_list.url_mapping | ||
return url_mapping(tag_mapping(uri)) |
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.
So is the following necessary in the top-level import pkg_resources
entry_points = []
for entry_point in pkg_resources.iter_entry_points('pytest11'):
entry_points.append(entry_point.name)
if "asdf_schema_tester" not in entry_points:
pytest_plugins = ['asdf.tests.schema_tester'] Plus enabling it in |
@jdavies-st since the new plugin is in a different namespace, I think there's actually no action required for packages that want to retain backwards compatibility. You will need to add |
But
in our conftest.py, then we get a plugin import error. Our 2 test runs yesterday against https://travis-ci.org/spacetelescope/jwst/builds/518489243 https://travis-ci.org/spacetelescope/jwst/jobs/518489251#L685 |
Ah yeah good point. Yes I guess you do need logic like what you posted above, then. I wonder if it would be better to use the version of |
Agree. Once a version of |
Previously packages were required to explicitly list the schema tester plugin in their
conftest.py
files. Now, the plugin is registered automatically withpytest
.The schema tests are no longer enabled by default. Instead, packages can do one of two things:
asdf_schema_tests_enabled = true
to the[tool:pytest]
section of theirsetup.cfg
file to enable tests by default, or--asdf-tests
to thepytest
command line to enable tests on a per-run basis.The new plugin is in a different namespace than the previous plugin, so it will not cause conflicts with packages that still include the plugin in
conftest.py
. However, the oldconftest.py
configuration should be removed unless packages want to retain backwards compatibility with older versions of ASDF.This closes #657.
cc @astrofrog