Sources: - Software Testing course at ITMO university by Kochubeev Nikolay Sergeevich - https://docs.pytest.org/en/stable/explanation/fixtures.html ====== Fixtures ====== Fixture is a defined and reliable context for the [[software_testing|tests]]. It is useful because of: * The reuse of the arrangement code. * A single initial state for a group of tests. * Simplification and reduction of tests. ==== Best practices ==== - The fixtures should be minimal — just what is needed for the tests. - Use SetUp/Teardown to clear resources. - In Python and Go, it is convenient to use yield/defer to free up resources.