-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 8.0.0rc1 stopped respecting usefixtures marker applied in pytest_itemcollected #11759
Comments
Thanks for trying the release candidate! Will debug this soon. |
Bisected to ab63ebb. |
The commit made doctest items more similar to function items, which (unintentionally) had this effect. This is to say, adding Now the Ideally this issue is resolved for both types of items. |
sounds like a great idea, I had quite some problems with conflicts due to double importing modules. Would be great if #11475 could be fixed for 8.0 to nail down doctests once and for all.
of course the least surprising thing from an API standpoint would be to make it just work for all items, but as an alternative, having a blessed way to hook into doctest setup and teardown would also be great! |
@flying-sheep Instead of using the hook, could you maybe do this? @pytest.fixture(autouse=True)
def suppress_env_for_doctests(request: pytest.FixtureRequest) -> None:
if isinstance(request.node, pytest.DoctestItem):
request.getfixturevalue("supress_env") |
pip list
from the virtual environment you are usingIn Pytest 7, adding a
pytest.mark.usefixtures
marker to apytest.Item
inpytest_itemcollected
resulted in that marker being respected. With Pytest 8, that’s not the case.The reproducer sets up two environments, one with Pytest 7.x, one with Pytest 8.0.0rc1, and runs a test suite:
reproducer
The text was updated successfully, but these errors were encountered: