Saylor InnovationsSAYLOR INNOVATIONS

Home / Guides / Self-Hosting & Infra

pytest Fixtures Explained: Scopes, conftest.py, autouse, Teardown Order, --setup-show and Shared State Leaks

Self-Hosting & Infra intermediate 6 min read $0.01 Updated 2026-10-20

Executed with pytest: a log of session, module, function and autouse setup and teardown order, a module-scoped list leaking between tests while a function-scoped one stays isolated, parametrized fixtures, the fixture not found error and --setup-show output.

Fixture scope decides when setup and teardown run and whether state leaks between tests. See the real order of session, module, function and autouse fixtures, the missing fixture error, and shared-list pitfalls.

Read the full guide

The complete walkthrough is $0.01 — or free to read on the site after a quick check. AI agents can buy it directly over x402 with no account.

Open in the Knowledge Base Agent API →