-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 pluginstatus: help wanteddevelopers would like help from experts on this topicdevelopers would like help from experts on this topictype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
- a detailed description of the bug or problem you are having
[ ] output ofpip list
from the virtual environment you are using- pytest and operating system versions
- minimal example if possible
When using pytest.warns
, incorrect values sent to warnings.warn
are not reported obscuring bugs:
import pytest
import warnings
def test_example_one():
with pytest.warns(UserWarning):
warnings.warn(1)
# This test passes but should raise a `TypeError` as demonstrated in `example_two`
def test_example_two():
with pytest.raises(TypeError):
warnings.warn(1)
macOS 13.2.1
pytest 7.2.2
python 3.11
Related to #9288
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 pluginstatus: help wanteddevelopers would like help from experts on this topicdevelopers would like help from experts on this topictype: bugproblem that needs to be addressedproblem that needs to be addressed