-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
WarningsRecorder.pop() improperly matches warning #10701
Copy link
Copy link
Closed
Labels
good first issueeasy issue that is friendly to new contributoreasy issue that is friendly to new contributorplugin: warningsrelated to the warnings builtin pluginrelated to the warnings builtin plugintype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch
Metadata
Metadata
Assignees
Labels
good first issueeasy issue that is friendly to new contributoreasy issue that is friendly to new contributorplugin: warningsrelated to the warnings builtin pluginrelated to the warnings builtin plugintype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch
When trying to pop a specific warning from a WarningsRecorder instance, the wrong warning is returned. I believe the issue is that pop uses issubclass
pytest/src/_pytest/recwarn.py
Line 210 in 3c15349
I believe the correct comparison should be:
Here is a minimum working example that triggers the buggy behavior:
The test output is
pytest 7.2.1 on archlinux.
virtual environment is a clean conda environment with only python and pytest (and their dependencies installed from conda-forge).
If this is indeed a bug, I'm happy to open a PR with my proposed solution.