Isolate Tests with a Test Database
Use a throwaway DB per test run.
Why Isolate the Database
Tests must never touch your real data. A test database keeps every run clean, so one test can never corrupt another or your production rows.
Use a Throwaway SQLite DB
The easy choice is an in-memory SQLite database. It lives only in RAM and vanishes the moment the test process ends.
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'All lessons in this course
- The Test Client and Fixtures
- Assert on Routes and JSON
- Isolate Tests with a Test Database
- Test Authenticated Endpoints