diff options
| author | Tim Graham <timograham@gmail.com> | 2026-02-09 20:28:05 -0500 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-02-10 16:06:49 -0500 |
| commit | ef46215fdecb755c0b77c47fdb8fec670abb5e8b (patch) | |
| tree | 22e756cd7b23ff5a1ad7bda04bf8145f02c1cebe | |
| parent | d007fcf7291cc3c24d4545e23c759bde22b6a8a6 (diff) | |
Added various missing test skips observed on MongoDB.
| -rw-r--r-- | tests/admin_changelist/tests.py | 2 | ||||
| -rw-r--r-- | tests/backends/base/test_base.py | 1 | ||||
| -rw-r--r-- | tests/fixtures_regress/tests.py | 1 | ||||
| -rw-r--r-- | tests/gis_tests/geoapp/test_expressions.py | 1 | ||||
| -rw-r--r-- | tests/migrations/test_executor.py | 1 | ||||
| -rw-r--r-- | tests/migrations/test_operations.py | 1 | ||||
| -rw-r--r-- | tests/test_utils/test_testcase.py | 7 | ||||
| -rw-r--r-- | tests/test_utils/tests.py | 3 | ||||
| -rw-r--r-- | tests/transaction_hooks/tests.py | 3 | ||||
| -rw-r--r-- | tests/transactions/tests.py | 3 |
10 files changed, 17 insertions, 6 deletions
diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py index 626558f496..a36574d4df 100644 --- a/tests/admin_changelist/tests.py +++ b/tests/admin_changelist/tests.py @@ -454,7 +454,7 @@ class ChangeListTests(TestCase): with self.assertRaises(IncorrectLookupParameters): m.get_changelist_instance(request) - @skipUnlessDBFeature("supports_transactions") + @skipUnlessDBFeature("uses_savepoints") def test_list_editable_atomicity(self): a = Swallow.objects.create(origin="Swallow A", load=4, speed=1) b = Swallow.objects.create(origin="Swallow B", load=2, speed=2) diff --git a/tests/backends/base/test_base.py b/tests/backends/base/test_base.py index 120584e7fc..2d19840851 100644 --- a/tests/backends/base/test_base.py +++ b/tests/backends/base/test_base.py @@ -93,6 +93,7 @@ class DatabaseWrapperTests(SimpleTestCase): self.assertEqual(gc.garbage, []) +@skipUnlessDBFeature("supports_transactions") class DatabaseWrapperLoggingTests(TransactionTestCase): available_apps = ["backends"] diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py index 999555effe..156c403c23 100644 --- a/tests/fixtures_regress/tests.py +++ b/tests/fixtures_regress/tests.py @@ -499,6 +499,7 @@ class TestFixtures(TestCase): self.assertEqual(Book.objects.all()[0].id, 1) self.assertEqual(Person.objects.all()[0].id, 4) + @skipUnlessDBFeature("supports_foreign_keys") def test_loaddata_raises_error_when_fixture_has_invalid_foreign_key(self): """ Data with nonexistent child key references raises error. diff --git a/tests/gis_tests/geoapp/test_expressions.py b/tests/gis_tests/geoapp/test_expressions.py index b56832bb6f..a93bffdbbc 100644 --- a/tests/gis_tests/geoapp/test_expressions.py +++ b/tests/gis_tests/geoapp/test_expressions.py @@ -54,6 +54,7 @@ class GeoExpressionsTests(TestCase): obj.point3.equals_exact(p1.transform(3857, clone=True), 0.1) ) + @skipUnlessDBFeature("has_Distance_function") def test_multiple_annotation(self): multi_field = MultiFields.objects.create( point=Point(1, 1), diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py index dd6793b533..060a35e379 100644 --- a/tests/migrations/test_executor.py +++ b/tests/migrations/test_executor.py @@ -162,6 +162,7 @@ class ExecutorTests(MigrationTestBase): self.assertTrue(Publisher.objects.exists()) self.assertTableNotExists("migrations_book") + @skipUnlessDBFeature("supports_transactions") @override_settings( MIGRATION_MODULES={"migrations": "migrations.test_migrations_atomic_operation"} ) diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py index 90c22bc73b..85295d8e50 100644 --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -5809,6 +5809,7 @@ class OperationTests(OperationTestBase): with self.assertRaisesMessage(ValueError, msg): migrations.RunPython(code=migrations.RunPython.noop, reverse_code="invalid") + @skipUnlessDBFeature("supports_transactions") def test_run_python_atomic(self): """ Tests the RunPython operation correctly handles the "atomic" keyword diff --git a/tests/test_utils/test_testcase.py b/tests/test_utils/test_testcase.py index 866e0dccc6..9d1b25fb47 100644 --- a/tests/test_utils/test_testcase.py +++ b/tests/test_utils/test_testcase.py @@ -82,10 +82,9 @@ def assert_no_queries(test): return inner -# On databases with no transaction support (for instance, MySQL with the MyISAM -# engine), setUpTestData() is called before each test, so there is no need to -# clone class level test data. -@skipUnlessDBFeature("supports_transactions") +# On databases without savepoint support, setUpTestData() is called before each +# test, so there's no need to clone class-level test data. +@skipUnlessDBFeature("uses_savepoints") class TestDataTests(TestCase): # setUpTestData re-assignment are also wrapped in TestData. jim_douglas = None diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py index 22b509b6b3..ef1d02cf41 100644 --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -1953,7 +1953,7 @@ class OverrideSettingsTests(SimpleTestCase): self.assertIn(expected_location, finder.locations) -@skipUnlessDBFeature("supports_transactions") +@skipUnlessDBFeature("uses_savepoints") class TestBadSetUpTestData(TestCase): """ An exception in setUpTestData() shouldn't leak a transaction which would @@ -2041,6 +2041,7 @@ class CaptureOnCommitCallbacksTests(TestCase): self.assertEqual(len(callbacks), 1) self.assertNotEqual(callbacks[0], pre_hook) + @skipUnlessDBFeature("uses_savepoints") def test_with_rolled_back_savepoint(self): with self.captureOnCommitCallbacks() as callbacks: try: diff --git a/tests/transaction_hooks/tests.py b/tests/transaction_hooks/tests.py index 5390165072..3bf18e73e3 100644 --- a/tests/transaction_hooks/tests.py +++ b/tests/transaction_hooks/tests.py @@ -155,6 +155,7 @@ class TestConnectionOnCommit(TransactionTestCase): self.assertNotified([]) self.assertDone([1]) + @skipUnlessDBFeature("uses_savepoints") def test_discards_hooks_from_rolled_back_savepoint(self): with transaction.atomic(): # one successful savepoint @@ -186,6 +187,7 @@ class TestConnectionOnCommit(TransactionTestCase): self.assertDone([]) + @skipUnlessDBFeature("uses_savepoints") def test_inner_savepoint_rolled_back_with_outer(self): with transaction.atomic(): try: @@ -211,6 +213,7 @@ class TestConnectionOnCommit(TransactionTestCase): self.assertDone([]) + @skipUnlessDBFeature("uses_savepoints") def test_inner_savepoint_does_not_affect_outer(self): with transaction.atomic(): with transaction.atomic(): diff --git a/tests/transactions/tests.py b/tests/transactions/tests.py index a3cd4cafee..bff1a30cf2 100644 --- a/tests/transactions/tests.py +++ b/tests/transactions/tests.py @@ -467,6 +467,7 @@ class AtomicMiscTests(TransactionTestCase): # exists. connection.savepoint_rollback(sid) + @skipUnlessDBFeature("supports_transactions") def test_mark_for_rollback_on_error_in_transaction(self): with transaction.atomic(savepoint=False): # Swallow the intentional error raised. @@ -512,6 +513,7 @@ class AtomicMiscTests(TransactionTestCase): Reporter.objects.create() +@skipUnlessDBFeature("supports_transactions") class NonAutocommitTests(TransactionTestCase): available_apps = [] @@ -520,6 +522,7 @@ class NonAutocommitTests(TransactionTestCase): self.addCleanup(transaction.set_autocommit, True) self.addCleanup(transaction.rollback) + @skipUnlessDBFeature("supports_foreign_keys") def test_orm_query_after_error_and_rollback(self): """ ORM queries are allowed after an error and a rollback in non-autocommit |
