pytest.warns({warning}) is too broad, set the match parameter or use a more specific warning
pytest-warns-require-match-for
Comma-separated list of warning names that require amatch=parameter in apytest.warning()call. By default the list contains the following warnings:WarningUserWarningDeprecationWarning
Bad code:
import pytest
def test_foo():
with pytest.warns(UserWarning):
...
# empty string is also an error
with pytest.warns(UserWarning, match=''):
...Good code:
import pytest
def test_foo():
with pytest.warns(UserWarning, match='expected message'):
...- to help ensure that the
pytest.warnsclause is not too broad