set the expected exception in pytest.raises()
Bad code:
import pytest
def test_foo():
with pytest.raises():
do_something()
Good code:
import pytest
def test_foo():
with pytest.raises(SomeException):
do_something()
- not passing the exception class will fail at runtime