pytest-django
pytest-django copied to clipboard
Upgrading to pytest 7 breaks django_db mark, and doesn't support pyproject.toml?
Once updating to Pytest 7 from 6.2.5, tests that work in pytest < 7 fail with:
RuntimeError: Database access not allowed, use the "django_db" mark, or the "db" or "transactional_db" fixtures to enable it.
and to configure the settings file, the only thing that worked was leaving a pytest.ini behind with only this setting (I've migrated the rest to pyproject.toml)
[pytest]
DJANGO_SETTINGS_MODULE = my_app.settings.test
Is this a supported configuration yet, with the settings module in a pyproject.toml?
- Django 4.0.2
- Pytest 7.0.1
- pytest-django 4.5.2
You can put this config in your pyproject.toml as well under:
[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "my_app.settings"
@HansBambel got it right!