|
1 | 1 | import pytest |
2 | 2 | from django.db import connection, transaction |
3 | | -from django.test.testcases import connections_support_transactions |
4 | 3 |
|
5 | 4 | from pytest_django.lazy_django import get_django_version |
6 | 5 | from pytest_django_test.app.models import Item |
@@ -66,21 +65,21 @@ def test_clean_db(self, all_dbs: None) -> None: |
66 | 65 | assert Item.objects.count() == 0 |
67 | 66 |
|
68 | 67 | def test_transactions_disabled(self, db: None) -> None: |
69 | | - if not connections_support_transactions(): |
| 68 | + if not connection.features.supports_transactions: |
70 | 69 | pytest.skip("transactions required for this test") |
71 | 70 |
|
72 | 71 | assert connection.in_atomic_block |
73 | 72 |
|
74 | 73 | def test_transactions_enabled(self, transactional_db: None) -> None: |
75 | | - if not connections_support_transactions(): |
| 74 | + if not connection.features.supports_transactions: |
76 | 75 | pytest.skip("transactions required for this test") |
77 | 76 |
|
78 | 77 | assert not connection.in_atomic_block |
79 | 78 |
|
80 | 79 | def test_transactions_enabled_via_reset_seq( |
81 | 80 | self, django_db_reset_sequences: None, |
82 | 81 | ) -> None: |
83 | | - if not connections_support_transactions(): |
| 82 | + if not connection.features.supports_transactions: |
84 | 83 | pytest.skip("transactions required for this test") |
85 | 84 |
|
86 | 85 | assert not connection.in_atomic_block |
@@ -120,7 +119,7 @@ def mydb(self, all_dbs: None) -> None: |
120 | 119 | Item.objects.create(name="spam") |
121 | 120 |
|
122 | 121 | def test_mydb(self, mydb: None) -> None: |
123 | | - if not connections_support_transactions(): |
| 122 | + if not connection.features.supports_transactions: |
124 | 123 | pytest.skip("transactions required for this test") |
125 | 124 |
|
126 | 125 | # Check the fixture had access to the db |
@@ -196,21 +195,21 @@ def test_clean_db(self) -> None: |
196 | 195 |
|
197 | 196 | @pytest.mark.django_db |
198 | 197 | def test_transactions_disabled(self) -> None: |
199 | | - if not connections_support_transactions(): |
| 198 | + if not connection.features.supports_transactions: |
200 | 199 | pytest.skip("transactions required for this test") |
201 | 200 |
|
202 | 201 | assert connection.in_atomic_block |
203 | 202 |
|
204 | 203 | @pytest.mark.django_db(transaction=False) |
205 | 204 | def test_transactions_disabled_explicit(self) -> None: |
206 | | - if not connections_support_transactions(): |
| 205 | + if not connection.features.supports_transactions: |
207 | 206 | pytest.skip("transactions required for this test") |
208 | 207 |
|
209 | 208 | assert connection.in_atomic_block |
210 | 209 |
|
211 | 210 | @pytest.mark.django_db(transaction=True) |
212 | 211 | def test_transactions_enabled(self) -> None: |
213 | | - if not connections_support_transactions(): |
| 212 | + if not connection.features.supports_transactions: |
214 | 213 | pytest.skip("transactions required for this test") |
215 | 214 |
|
216 | 215 | assert not connection.in_atomic_block |
|
0 commit comments