A drop-in TEST_RUNNER for Django's manage.py test that brings pytest-style workflow features to the native Django test runner. No pytest migration required.
pip install django_fail_betterOr with uv:
uv pip install django_fail_better# settings.py
TEST_RUNNER = "django_fail_better.FailBetterRunner"# CLI
python manage.py test --lf --maxfail=3All options are passed to manage.py test like any other test runner argument.
| Option | Alias | Type / Choices | Default | Description |
|---|---|---|---|---|
--last-failed |
--lf |
flag | False |
Run only the tests that failed at the last run (or all if none failed). |
--last-failed-no-failures |
--lfnf |
all / none |
all |
With --lf, determines whether to execute tests when there are no previously (known) failures or when no cached lastfailed data was found. all (the default) runs the full test suite again. none just emits a message about no known failures and exits successfully. |
--failed-first |
--ff |
flag | False |
Run all tests, but run the last failures first. |
--maxfail |
— | int |
0 (unlimited) |
Exit after first num failures or errors |
--failure-cache-show |
— | flag | False |
Show failure cache contents, don't perform collection or tests. |
--failure-cache-clear |
— | flag | False |
Remove all failure cache contents at start of test run. |
--stepwise |
--sw |
flag | False |
Exit on test failure and continue from last failing test next time |
--stepwise-skip |
--sw-skip |
flag | False |
Ignore the first failing test but stop on the next failing test. Implicitly enables --stepwise. |
--stepwise-reset |
--sw-reset |
flag | False |
Resets stepwise state, restarting the stepwise workflow. Implicitly enables --stepwise. |