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
[ ] output ofpip listfrom the virtual environment you are usingWhen using
pytest.warns, incorrect values sent towarnings.warnare not reported obscuring bugs:Related to #9288