Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PyTest Fixture setup and teardown output

test_fixture.py .F.
$ pytest -sq test_fixture.py

Output:

setup_module:         <TemporaryDirectory '/tmp/tmpaq1r7lnj'>
  setup_function                                              <TemporaryDirectory '/tmp/tmpvynb1e5h'>
    test_one          <TemporaryDirectory '/tmp/tmpaq1r7lnj'> <TemporaryDirectory '/tmp/tmpvynb1e5h'>
    test_one after
  teardown_function                                           <TemporaryDirectory '/tmp/tmpvynb1e5h'>
  setup_function                                              <TemporaryDirectory '/tmp/tmp6cman2br'>
    test_two          <TemporaryDirectory '/tmp/tmpaq1r7lnj'> <TemporaryDirectory '/tmp/tmp6cman2br'>
  teardown_function                                           <TemporaryDirectory '/tmp/tmp6cman2br'>
  setup_function                                              <TemporaryDirectory '/tmp/tmpbi9pwo3j'>
    test_three        <TemporaryDirectory '/tmp/tmpaq1r7lnj'> <TemporaryDirectory '/tmp/tmpbi9pwo3j'>
    test_three after
.  teardown_function                                          <TemporaryDirectory '/tmp/tmpbi9pwo3j'>
teardown_module       <TemporaryDirectory '/tmp/tmpaq1r7lnj'>

Note, the teardown_function is executed even after failed tests.