Skip to content
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

pytest won't run root conftest.py's pytest_configure in special circumstances #11365

Closed
Redoubts opened this issue Aug 29, 2023 · 2 comments
Closed
Labels
topic: config related to config handling, argument parsing and config file type: bug problem that needs to be addressed

Comments

@Redoubts
Copy link

Consider the following project: https://github.com/Redoubts/_pytest_bug_report

There's a root level conftest.py, and 3 plugins (two loaded in the conftest, and a third loaded by plugin 2). All define a pytest_configure in some way.

with platform darwin -- Python 3.11.4, pytest-7.4.0, pluggy-1.0.0, we see

% pytest test1.py
mypackage.plugin2 Configured
mypackage.plugin3 Configured
conftest Configured
mypackage.plugin Configured

Which is somewhat expected, each pytest_configure gets called.

If you update pluggy to 1.2+, you see

% pytest test1.py           
mypackage.plugin2 Configured
mypackage.plugin3 Configured
mypackage.plugin Configured
mypackage.plugin3 Configured
============================================================================================ test session starts =============================================================================================
platform darwin -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0
...

Where the third plugin's pytest_configure is called twice, but the root pytest_configure is never called.

I think this is more specifically due to mypackage/plugin3.py's @pytest.hookimpl wrapper. Maybe it's ill advised to do that, but I found this bizarre scenario when testing package updates in a much larger codebase.

@RonnyPfannschmidt
Copy link
Member

This looks like a bug on the pluggy/pytest side

@Zac-HD Zac-HD added type: bug problem that needs to be addressed topic: config related to config handling, argument parsing and config file labels Sep 7, 2023
@Redoubts
Copy link
Author

solved in pluggy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: config related to config handling, argument parsing and config file type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

4 participants
@RonnyPfannschmidt @Redoubts @Zac-HD and others