Test Fixtures
Setup and teardown
Interview Relevant: Test organization
Fixtures
Reliable way to setup state for tests.
Code Examples
python
1import pytest
2
3@pytest.fixture
4def data():
5 return [1, 2, 3]
6
7def test_sum(data):
8 assert sum(data) == 6