-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Ensure Config.inifile is available during pytest_cmdline_main #9400
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
Conversation
src/_pytest/legacypath.py
Outdated
|
|
||
| @pytest.hookimpl | ||
| def pytest_configure(config: pytest.Config) -> None: | ||
| def pytest_load_initial_conftests(early_config: pytest.Config) -> None: |
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.
Changing to pytest_load_initial_conftests to monkey patch the attributes as it executes earlier than pytest_configure.
| @pytest.hookimpl | ||
| def pytest_configure(config: pytest.Config) -> None: | ||
| """Installs the LegacyTmpdirPlugin if the ``tmpdir`` plugin is also installed.""" | ||
| if config.pluginmanager.has_plugin("tmpdir"): |
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 LegacyTmpdirPlugin should be installed during pytest_configure as that's called after tmpdir is installed.
4098fc2 to
23c38b3
Compare
23c38b3 to
9510bd7
Compare
| hc = pm.hook.pytest_load_initial_conftests | ||
| values = hc._nonwrappers + hc._wrappers | ||
| expected = [ | ||
| assert [x.function.__module__ for x in hc._nonwrappers] == [ |
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.
Decided to also split checking wrappers and non-wrappers, seems better to explicitly test them separately.
76d1c6d to
ef086a3
Compare
|
@RonnyPfannschmidt gentle ping. 👍 |
|
I've held back merging this as I wasn't sure if we preferred to revert the plugin entirely or not - with #9438 I assume we decided to keep it, but this conflicts now due to the import changes. After the conflicts are resolved I think this is good to go. Thanks @nicoddemus and happy new year! 🎉 |
|
I will fix this later today or tomorrow the latest! Happy new year! |
…dering Seems better to test which one is which explicitly.
ef086a3 to
696f955
Compare
Fix #9396