Skip to main content
Community
Q&A

Best practices for organizing pytest fixtures in large test suites?

Ajitesh Mohanta
Ajitesh MohantaAmbassador
May 7, 2026 12 0
I'm working on a fairly large test project (~500 tests across 3 microservices) and our conftest.py files are getting unwieldy. We currently have one root conftest.py with 40+ fixtures, and the team keeps adding more without a clear structure. Has anyone dealt with this at scale? I'm specifically wondering: 1. How do you organize fixtures across multiple conftest.py files? 2. Should database/API fixtures live in a shared package? 3. Any patterns for fixture factories vs. direct fixtures? We're using pytest 8.x with async support (pytest-asyncio). Our stack is FastAPI + PostgreSQL + pytest.

No replies yet. Be the first to answer this question!

Join the discussion

Sign in to join the discussion

Sign in
Best practices for organizing pytest fixtures in large test suites? — Community | QABash