PyTest Fixture setup and teardown output
test_fixture.py .F.
$ pytest -sq test_fixture.py
Output:
setup_module: /tmp/tmp5vfj_uuh
setup_function 1773757663.796925
test_one /tmp/tmp5vfj_uuh 1773757663.796925
test_one after
. teardown_function 1773757663.796925
setup_function 1773757663.797643
test_two /tmp/tmp5vfj_uuh 1773757663.797643
F teardown_function 1773757663.797643
setup_function 1773757663.8085847
test_three /tmp/tmp5vfj_uuh 1773757663.8085847
test_three after
. teardown_function 1773757663.8085847
teardown_module /tmp/tmp5vfj_uuh
=================================== FAILURES ===================================
___________________________________ test_two ___________________________________
def test_two():
print(f" test_two {db_server.name} {db}")
> assert False
E assert False
test_fixture.py:29: AssertionError
=========================== short test summary info ============================
FAILED test_fixture.py::test_two - assert False
1 failed, 2 passed in 0.06s
Note, the teardown_function is executed even after failed tests.