found assertion on exception {name} in except block, use pytest.raises() instead
Bad code:
def test_foo():
try:
1 / 0
except ZeroDivisionError as e:
assert e.argsGood code:
import pytest
def test_foo():
with pytest.raises(ZeroDivisionError) as e:
1 / 0
assert e.value.args- to avoid the situations when the test incorrectly passes because exception was not raised