setup and teardown

The work done before a test to prepare what it needs, and after it to clean up, such as closing files or stopping containers.

In more detail

In a pytest yield fixture, everything before yield is setup and everything after it is teardown, which runs even when the test fails. Older frameworks use separate setUp and tearDown methods that run for every test whether it needs them or not.

Related terms

Taught in

References