From 8889c9e5def659100a5430130788dddffffc1628 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 28 Sep 2024 17:30:37 +0300 Subject: [PATCH] fixtures: drop compat code for no longer supported Django versions --- pytest_django/fixtures.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pytest_django/fixtures.py b/pytest_django/fixtures.py index 9e03e868..a466ddb1 100644 --- a/pytest_django/fixtures.py +++ b/pytest_django/fixtures.py @@ -165,8 +165,6 @@ def _django_db_helper( django_db_setup: None, django_db_blocker: DjangoDbBlocker, ) -> Generator[None, None, None]: - from django import VERSION - if is_django_unittest(request): yield return @@ -240,13 +238,9 @@ class PytestDjangoTestCase(test_case_class): # type: ignore[misc,valid-type] @classmethod def setUpClass(cls) -> None: super(django.test.TestCase, cls).setUpClass() - if VERSION < (4, 1): - django.db.transaction.Atomic._ensure_durability = False @classmethod def tearDownClass(cls) -> None: - if VERSION < (4, 1): - django.db.transaction.Atomic._ensure_durability = True super(django.test.TestCase, cls).tearDownClass() PytestDjangoTestCase.setUpClass() @@ -260,8 +254,7 @@ def tearDownClass(cls) -> None: PytestDjangoTestCase.tearDownClass() - if VERSION >= (4, 0): - PytestDjangoTestCase.doClassCleanups() + PytestDjangoTestCase.doClassCleanups() django_db_blocker.restore()