-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
pytester: do not use outer plugins #4518
Conversation
Sets PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 by default. Fixes pytest-dev#4351.
Codecov Report
@@ Coverage Diff @@
## master #4518 +/- ##
===========================================
- Coverage 95.91% 42.48% -53.44%
===========================================
Files 111 92 -19
Lines 25093 20852 -4241
Branches 2448 2337 -111
===========================================
- Hits 24068 8859 -15209
- Misses 724 11404 +10680
- Partials 301 589 +288
Continue to review full report at Codecov.
|
_, dom = runandparse(testdir, "-n2") | ||
# XXX: why does "-p xdist" work here, but xdist.plugin is required with | ||
# other tests (to recognize the pytest_configure hook in there)?! | ||
_, dom = runandparse(testdir, "-p xdist -n2") |
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.
Any idea about this?
I've assumed that -p xdist
would work in general, but it looks like if it was loaded in the outer pytest already xdist
does not contain the pytest_configure
hook - likely because the entrypoint mapping is not considered anymore (from "xdist" to "xdist.plugin") - but why does it work here then?
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.
the -p argument passes modules, not entrypoints, ever since xdist was split up to aid removing messy stuff that was no longer usable in that way
the xdist module itself no longer contains the hooks, different submodules do
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.
Yeah.. but why is "-p xdist" enough here?
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.
https://github.com/pytest-dev/pytest-xdist/blob/master/setup.py#L19 - it appears the xdist core plugin is named by entrypoint
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.
What confuses me here is that -p xdist.plugin
is required in other places here, but -p xdist
here. Likely some internal sys.path thing or similar..
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.
i propose introducing a pytest ini option and a mark for white-listing distributions, for pytester
and triggering a warning in pytester if it is not set (and then just not checking it)
simply disabling it certainly doesn't cut it
Not sure if I understand this correctly: if the ini option / mark is not provided it should issue a warning, and otherwise load the whitelisted/given plugins (which could be empty then)? I think it could be also just silent, but allow for pytest to use the option itself? |
the ini option/mark would set the elements of the whitelist for plugin loading, an empty whitelist must trigger a warning and load all plugins, else we do have a breaking change that will break testsuites of other pytest plugins |
I would consider empty different from not set here, no? |
i would consider them the same, as practically speaking not using the whitelist is for certain to make a flaky testsuite |
Assuming there would be an option/marker - how would we set it for all of pytest's own tests then? |
pytests own tests should use pytests own pytest.ini |
That would include things like testpaths etc then though. |
Closing in favor of #4521. |
Sets PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 by default.
Fixes #4351.