Django "manage.py test" vs pytest picking up no tests in CI
A CI job passes suspiciously fast because no tests actually ran. Django's manage.py test and pytest discover tests differently, so switching runners (or misconfiguring one) can silently collect zero tests and report green.
What this error means
The step logs "Ran 0 tests in 0.000s" from the Django runner, or pytest prints "collected 0 items", and the job passes without exercising anything.
Ran 0 tests in 0.001s
OKCommon causes
The two runners use different discovery
Django's runner looks under a tests label and unittest naming; pytest uses testpaths and python_files. A layout that fits one may collect nothing under the other.
pytest-django not installed or wrong settings
Running pytest without pytest-django, or with a settings module that excludes the apps, yields zero collected DB tests.
How to fix it
Pick one runner and configure discovery
If you use pytest, install pytest-django and set testpaths so collection is deterministic.
[pytest]
DJANGO_SETTINGS_MODULE = myproject.settings.ci
testpaths = tests
python_files = test_*.pyAssert a nonzero test count
Fail the build if collection finds nothing, so a green run always means tests ran.
pytest --strict-markers | tee out.txt
grep -Eq "[1-9][0-9]* passed" out.txtHow to prevent it
- Standardize on one test runner and configure its discovery explicitly.
- Install pytest-django when using pytest against a Django project.
- Guard against 0 collected tests so a silent pass cannot slip through.