Testing with a Real, Throwaway Database
API tests that touch a database get a fresh SQLite file in pytest's tmp_path for every test, with the migrations run and a few rows added in a fixture, and app.dependency_overrides swaps get_db for one that opens that file, so the tests run real SQL without ever touching the real data.
Updated

- Category
- FastAPI
- Level
- Journeyman
- Tags
- Dependency Override, fastapi, Integration Test, Mock, rest-api, Test Fixture (python), tmp_path