Analogy: a shared toolbox, and a rule for how long you may borrow a tool. The toolbox sits in the hall. Any room on this floor can use it. A hammer you borrow for one job goes back at the end of that job. A generator you start for the whole day stays on until the day ends.
Tom shares synthetic test resources through a , chooses a when its lifetime is appropriate, and checks fixture lookup order from the requesting test's location.
A shared toolbox or stationery cupboard can serve nearby rooms without each room importing its own copy. Sharing is a visibility and lifetime decision, not permission for tests to depend on another test's leftovers.
The picture has a limit. Session scope is not a guarantee of exactly one setup across every parameter combination or parallel worker. Mutable shared state and failed setup require explicit handling.
(SYNTHETIC / TRAINING ONLY: Daily List and every named person are invented.)
PLAIN WORDS · 1 in this section
mutable
able to be changed
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Provide appropriately visible pytest fixtures with deliberate lifetime, isolation and cleanup.
1Cupboard
2Term
3Lesson
School corridor
HOW THE PICTURE MAPS
How each part of the picture matches the software
In the picture
In the software
The stationery cupboard
The conftest file
A classroom on the corridor
A test in that folder or below
Pens bought for the whole term
A session-scoped fixture
A pen for one lesson
A function-scoped fixture
WHERE THIS PICTURE STOPS
A shared fixture can retain mutable or external state; choosing a long scope does not prove isolation.
Session caching, fixture parameters and separate workers mean session scope is not an exactly-once global guarantee.
pytest fixture guide ↗ — pytest-dev contributors · Scopes and parameter caching; yield-setup failure; broader/narrower dependency lifetimes (selected actual primary passages read 7 November 2026; live publisher documentation, not every linked section or historical release).
Scopes and parameter caching; yield-setup failure; broader/narrower dependency lifetimes. Product/configuration-specific guidance; not a universal team practice. · Checked 2026-11-07
Selected actual primary passages read, including the specific fixture/marker/collection boundaries described. Daily List rules, people and paths are synthetic; no pytest/xdist execution or complete production fixture design is claimed. Live documentation has no fixed edition claimed.
Implementation-specific
pytest fixture reference ↗ — pytest-dev contributors · Availability from requesting test perspective; conftest upward search and nearest applicable override (selected actual primary passages read 7 November 2026; live publisher documentation, not every linked section or historical release).
Availability from requesting test perspective; conftest upward search and nearest applicable override. Product/configuration-specific guidance; not a universal team practice. · Checked 2026-11-07
Selected actual primary passages read, including the specific fixture/marker/collection boundaries described. Daily List rules, people and paths are synthetic; no pytest/xdist execution or complete production fixture design is claimed. Live documentation has no fixed edition claimed.
Implementation-specific
pytest-xdist how-to ↗ — pytest-dev contributors · Session-scoped fixtures across separate workers; optional cross-process coordination example (selected actual primary passages read 7 November 2026; live publisher documentation, not every linked section or historical release).
Session-scoped fixtures across separate workers; optional cross-process coordination example. Product/configuration-specific guidance; not a universal team practice. · Checked 2026-11-07
Selected actual primary passages read, including the specific fixture/marker/collection boundaries described. Daily List rules, people and paths are synthetic; no pytest/xdist execution or complete production fixture design is claimed. Live documentation has no fixed edition claimed.
pytest fixture guide ↗ — pytest-dev contributors · Scopes and parameter caching; yield-setup failure; broader/narrower dependency lifetimes (selected actual primary passages read 7 November 2026; live publisher documentation, not every linked section or historical release).
Scopes and parameter caching; yield-setup failure; broader/narrower dependency lifetimes. Product/configuration-specific guidance; not a universal team practice. · Checked 2026-11-07
Selected actual primary passages read, including the specific fixture/marker/collection boundaries described. Daily List rules, people and paths are synthetic; no pytest/xdist execution or complete production fixture design is claimed. Live documentation has no fixed edition claimed.
Implementation-specific
pytest fixture reference ↗ — pytest-dev contributors · Availability from requesting test perspective; conftest upward search and nearest applicable override (selected actual primary passages read 7 November 2026; live publisher documentation, not every linked section or historical release).
Availability from requesting test perspective; conftest upward search and nearest applicable override. Product/configuration-specific guidance; not a universal team practice. · Checked 2026-11-07
Selected actual primary passages read, including the specific fixture/marker/collection boundaries described. Daily List rules, people and paths are synthetic; no pytest/xdist execution or complete production fixture design is claimed. Live documentation has no fixed edition claimed.
Implementation-specific
pytest-xdist how-to ↗ — pytest-dev contributors · Session-scoped fixtures across separate workers; optional cross-process coordination example (selected actual primary passages read 7 November 2026; live publisher documentation, not every linked section or historical release).
Session-scoped fixtures across separate workers; optional cross-process coordination example. Product/configuration-specific guidance; not a universal team practice. · Checked 2026-11-07
Selected actual primary passages read, including the specific fixture/marker/collection boundaries described. Daily List rules, people and paths are synthetic; no pytest/xdist execution or complete production fixture design is claimed. Live documentation has no fixed edition claimed.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.