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
Ensure Config.inifile is available during pytest_cmdline_main #9400
Conversation
src/_pytest/legacypath.py
Outdated
@@ -401,26 +401,10 @@ def Node_fspath_set(self: Node, value: LEGACY_PATH) -> None: | |||
|
|||
|
|||
@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
@@ -1264,15 +1264,16 @@ def pytest_load_initial_conftests(self): | |||
m = My() | |||
pm.register(m) | |||
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