Pytest Runner
Always activate the virtualenv before running pytest. Look for .venv in the project directory:
bash
source .venv/bin/activate && pytest <test-path> --reuse-db -n <N>
Test Selection
Always specify which tests to run. Never run the entire suite without reason.
Run most-likely-to-fail first:
- •New/changed test file specifically
- •Entire module the changes belong to
- •Entire project (only if needed)
--reuse-db
Always pass --reuse-db — unless you made model (database) changes beforehand, then omit it so the DB is recreated.
Concurrency (-n flag)
- •1 test:
-n0 - •2-7 tests:
-nmatching count (e.g. 3 tests →-n 3) - •8+ tests: omit
-nentirely