pytest and Failed: Database access not allowed, use the “django_db” mark, or the “db” or “transactional_db” fixtures to enable it
Solution: import pytest @pytest.mark.django_db class TestExample: def test_one(): … Assume that you’ve created a TestExample class inside your test file and it should be decorated with @pytest.mark.django_db. It should solve your problem.