pypi / pytest-django
pytest-django
What changed in pytest-django 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-27.
1 breaking2 new APIs and options5 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initpytest-django 48 changes
Breaking changes 1
Support for Django 4.2 and 5.1 was dropped.
New APIs and options 2
The django extra lets the dependency resolver select a pytest-django version compatible with the installed Django version, using a lower bound only.
The top-level pytest_django module now exports Settings so the settings fixture can be type-annotated.
Fixes and other changes 5
Unofficial support for Django 5.0 and Django 5.1 has been restored.
Type hints for assert methods now match their actual signature.
django_db(transaction=True) tests are no longer set up twice, preventing repeated serialized_rollback restores and fixture loads, and duplicate signals when available_apps is set.
When the configured settings module cannot be imported, Django 6.2’s ImproperlyConfigured is handled in addition to ImportError so pytest-django still shows its guidance message.
Django is now set up before initial conftests load when --help or --version is passed, avoiding AppRegistryNotReady failures when conftest.py imports Django models at the top level.