diff options
| author | zhangyangyu <angwerzx@126.com> | 2022-04-12 16:54:17 +0800 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-04-12 13:37:44 +0200 |
| commit | 1bb9bd972424771246022bcf2c61e0eb87a0f337 (patch) | |
| tree | c0ab0a8cbffb6b0d7707e8f790a6d097d2c5c6fd /tests/test_utils | |
| parent | 24f442b91dd1e3e440ec929f4ad9907d53aa69bc (diff) | |
Fixed #33633 -- Skipped some test_utils tests on databases that don't support transactions.
Diffstat (limited to 'tests/test_utils')
| -rw-r--r-- | tests/test_utils/test_testcase.py | 5 | ||||
| -rw-r--r-- | tests/test_utils/tests.py | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_utils/test_testcase.py b/tests/test_utils/test_testcase.py index ca142186a1..eb6ca80036 100644 --- a/tests/test_utils/test_testcase.py +++ b/tests/test_utils/test_testcase.py @@ -41,6 +41,7 @@ class TestTestCase(TestCase): with self.assertRaisesMessage(DatabaseOperationForbidden, message): Car.objects.using("other").get() + @skipUnlessDBFeature("supports_transactions") def test_reset_sequences(self): old_reset_sequences = self.reset_sequences self.reset_sequences = True @@ -61,6 +62,10 @@ 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") 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 6a4467fdcb..fb19d6e464 100644 --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -2126,6 +2126,7 @@ class OverrideSettingsTests(SimpleTestCase): self.assertIn(expected_location, finder.locations) +@skipUnlessDBFeature("supports_transactions") class TestBadSetUpTestData(TestCase): """ An exception in setUpTestData() shouldn't leak a transaction which would @@ -2160,6 +2161,7 @@ class TestBadSetUpTestData(TestCase): self.assertFalse(self._in_atomic_block) +@skipUnlessDBFeature("supports_transactions") class CaptureOnCommitCallbacksTests(TestCase): databases = {"default", "other"} callback_called = False |
