Testing
Advanced Fixtures
Scoped fixtures, conftest, and factory fixtures
Interview: Test architecture — mid to senior level
Fixtures Deep Dive
Fixtures are pytest's most powerful feature. They provide dependency injection for test setup, enabling clean, reusable test infrastructure.
Fixture Scopes
- function (default): Created for each test function
- class: Shared across all tests in a class
- module: Created once per test file
- session: Created once for the entire test run