tests: fix tests that require PYTEST_DISABLE_PLUGIN_AUTOLOAD to be unset#4520
Conversation
Fix pytest's own tests with PYTEST_DISABLE_PLUGIN_AUTOLOAD=1.
|
Maybe that should be done in a more central place, |
Not in Therefore I suggest leaving it like this (in this PR), until it eventually gets deprecated / replaced by an env that allows a list (or rather via |
How about an autouse fixture which unsets this variable? But I'm not sure, your initial point seems valid, we shouldn't actually leak any external |
|
@nicoddemus Therefore I think it is good to unset it explicitly where we need it (and where we control the entrypoints processing manually mostly). |
Possibly, but in those cases users might want to adjust their tests accordingly. Well I'm not sure, we have this variables:
I don't see a case where a user would like for a test to depend on one of these variables being set externally... if a test does depend on them, the user should set it explicitly in the test, I believe.
Problem is that it is error prone: nothing was failing until you executed the suite with |
|
PYTEST_DISABLE_PLUGIN_AUTOLOAD was added in #3787, and it sounds like it is used in distributions - e.g. pytest's test should not use |
|
Sorry, not sure I follow... it seems to me that pytester should never autoload external plugins, as we want to isolate the test run. |
|
@nicoddemus that breaks pytester for 3rd party plugins |
You mean Or am I missing something? |
|
@nicoddemus I agree with your sentiment of having a clear environment for internal runs, but it does not work in this case. See #4519 (comment). |
|
|
|
@nicoddemus |
|
I see, thanks for the reference. How about the other environment variables other than |
|
Yeah, I'm in favor of removing them / having a clean env. |
Fix pytest's own tests with PYTEST_DISABLE_PLUGIN_AUTOLOAD=1.