diff --git a/tests/test_database.py b/tests/test_database.py index 7ad5f599..c116e996 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -1,6 +1,5 @@ import pytest from django.db import connection, transaction -from django.test.testcases import connections_support_transactions from pytest_django.lazy_django import get_django_version from pytest_django_test.app.models import Item @@ -66,13 +65,13 @@ def test_clean_db(self, all_dbs: None) -> None: assert Item.objects.count() == 0 def test_transactions_disabled(self, db: None) -> None: - if not connections_support_transactions(): + if not connection.features.supports_transactions: pytest.skip("transactions required for this test") assert connection.in_atomic_block def test_transactions_enabled(self, transactional_db: None) -> None: - if not connections_support_transactions(): + if not connection.features.supports_transactions: pytest.skip("transactions required for this test") assert not connection.in_atomic_block @@ -80,7 +79,7 @@ def test_transactions_enabled(self, transactional_db: None) -> None: def test_transactions_enabled_via_reset_seq( self, django_db_reset_sequences: None, ) -> None: - if not connections_support_transactions(): + if not connection.features.supports_transactions: pytest.skip("transactions required for this test") assert not connection.in_atomic_block @@ -120,7 +119,7 @@ def mydb(self, all_dbs: None) -> None: Item.objects.create(name="spam") def test_mydb(self, mydb: None) -> None: - if not connections_support_transactions(): + if not connection.features.supports_transactions: pytest.skip("transactions required for this test") # Check the fixture had access to the db @@ -196,21 +195,21 @@ def test_clean_db(self) -> None: @pytest.mark.django_db def test_transactions_disabled(self) -> None: - if not connections_support_transactions(): + if not connection.features.supports_transactions: pytest.skip("transactions required for this test") assert connection.in_atomic_block @pytest.mark.django_db(transaction=False) def test_transactions_disabled_explicit(self) -> None: - if not connections_support_transactions(): + if not connection.features.supports_transactions: pytest.skip("transactions required for this test") assert connection.in_atomic_block @pytest.mark.django_db(transaction=True) def test_transactions_enabled(self) -> None: - if not connections_support_transactions(): + if not connection.features.supports_transactions: pytest.skip("transactions required for this test") assert not connection.in_atomic_block diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py index d8e03adc..fe3cb94b 100644 --- a/tests/test_fixtures.py +++ b/tests/test_fixtures.py @@ -14,7 +14,6 @@ from django.core import mail from django.db import connection, transaction from django.test.client import Client, RequestFactory -from django.test.testcases import connections_support_transactions from django.utils.encoding import force_str from pytest_django_test.app.models import Item @@ -374,7 +373,7 @@ def test_settings_restored(self) -> None: assert settings.ALLOWED_HOSTS == ["testserver"] def test_transactions(self, live_server) -> None: - if not connections_support_transactions(): + if not connection.features.support_transactions: pytest.skip("transactions required for this test") assert not connection.in_atomic_block