Django’s Magic, FastAPI’s Reality: Test Isolation at Scale
- Track:
- Web Development, Web APIs, Front-End Integration
- Type:
- Talk
- Level:
- intermediate
- Duration:
- 30 minutes
Abstract
Your FastAPI + SQLAlchemy tests pass alone but fail together. Data leaks between tests, and cleanup becomes slower. Meanwhile, it seems effortless in Django. Why?
This isn't a framework war - we'll dig into what Django actually does behind the scenes to keep the database clean between tests and why that approach isn’t straightforward to replicate in a typical SQLAlchemy setup.
We'll explore common cleanup strategies like recreating schema, truncating, transaction wrapping or template databases and benchmark how they scale as your test suite grows.
You'll leave with a clear understanding of why this problem exists and practical, benchmarked options to keep your test suite fast and data isolated.
Aimed at intermediate Python developers comfortable with writing tests and familiar with basic database concepts like transactions.