Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pytest_django/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ def _django_db_helper(
yield
return

from django import VERSION

marker = request.node.get_closest_marker("django_db")
if marker:
(
Expand Down Expand Up @@ -289,7 +291,11 @@ def tearDownClass(cls) -> None:
PytestDjangoTestCase.setUpClass()

test_case = PytestDjangoTestCase(methodName="__init__")
if not PytestDjangoTestCase._pre_setup_ran_eagerly:
if VERSION >= (6, 0):
pre_setup_ran_eagerly = PytestDjangoTestCase._pre_setup_ran_eagerly
else:
pre_setup_ran_eagerly = getattr(PytestDjangoTestCase, "_pre_setup_ran_eagerly", False)
if not pre_setup_ran_eagerly:
# For a TransactionTestCase, setUpClass() has already run _pre_setup() and set
# this flag to say so.
test_case._pre_setup()
Expand Down