Multiple Failures in separate test functions
Every test function is executed separately. Normally pytest will run all the test functions, collect the results
and display a summary. In this example we have 5 test functions. We don’t really test anything in them but calling assert False will fail the given test.
def test_one():
print('one before')
assert True
print('one after')
def test_two():
print('two before')
assert False
print('two after')
def test_three():
print('three before')
assert True
print('three after')
def test_four():
print('four before')
assert False
print('four after')
def test_five():
print('five before')
assert True
print('five after')
We can run this as pytest test_failures.py and observe the results.