pytest.raises({exception}) is too broad, set the match parameter or use a more specific exception
pytest-raises-require-match-for
Comma-separated list of exception names that require amatch=parameter in apytest.raises()call. By default the list contains the following exceptions:BaseException,ExceptionValueErrorOSError,IOError,EnvironmentError,socket.error
Bad code:
import pytest
def test_foo():
with pytest.raises(ValueError):
...
# empty string is also an error
with pytest.raises(ValueError, match=''):
...Good code:
import pytest
def test_foo():
with pytest.raises(ValueError, match='expected message'):
...- to help ensure that the
pytest.raisesclause is not too broad