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

BUG: Fix warning stacklevel #12564

Closed
wants to merge 5 commits into from
Closed

Conversation

larsoner
Copy link
Contributor

@larsoner larsoner commented Jul 2, 2024

Similar to #12014, improves this warning:

  /home/larsoner/python/virtualenvs/base/lib/python3.12/site-packages/_pytest/fixtures.py:1303: PytestRemovedIn9Warning: Marks applied to fixtures have no effect

to become:

  /home/larsoner/python/mne-nirs/mne_nirs/conftest.py:133: PytestRemovedIn9Warning: Marks applied to fixtures have no effect

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jul 2, 2024
@larsoner
Copy link
Contributor Author

larsoner commented Jul 2, 2024

py313 failures look unrelated

Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm if I'm not mistaken (didn't check), the exact depth depends on how many decorators there are? So it's at least 3, since there needs to be at least one mark decorator, but it can be more (such as the test where it's 4).

@larsoner
Copy link
Contributor Author

larsoner commented Jul 2, 2024

I pushed some commits to do a bit of inspect magic to figure out where to emit the warning by traversing the stack until out of the _pytest module. FWIW I adapted it from some code we've used for at least 5 years over in MNE-Python without any real issues. Happy to continue down this path if it seems useful or fine with closing if it seems too magical!

@larsoner
Copy link
Contributor Author

larsoner commented Jul 2, 2024

Yep, too magical -- tests fail because it ends up in the _hypothesis_pytestplugin.py namespace. I'll close!

@larsoner larsoner closed this Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided (automation) changelog entry is part of PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants