# Testing with a Real Database

Testing with a Real Database: Testing with a Real, Throwaway Database.

Updated: November 19, 2026

1. [Testing with a Real, Throwaway Database](https://www.ask-codey.com/lessons/fastapi-data-testing-real-database) (Journeyman): 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.

Source: https://www.ask-codey.com/courses/python-web-apis/topics/fastapi-testing-with-a-database
