summaryrefslogtreecommitdiff
path: root/tests/test_utils/test_testcase.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_utils/test_testcase.py')
-rw-r--r--tests/test_utils/test_testcase.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/test_utils/test_testcase.py b/tests/test_utils/test_testcase.py
index 8a367391cb..f374549400 100644
--- a/tests/test_utils/test_testcase.py
+++ b/tests/test_utils/test_testcase.py
@@ -1,7 +1,7 @@
from django.db import IntegrityError, transaction
from django.test import TestCase, skipUnlessDBFeature
-from .models import PossessedCar
+from .models import Car, PossessedCar
class TestTestCase(TestCase):
@@ -18,3 +18,12 @@ class TestTestCase(TestCase):
car.delete()
finally:
self._rollback_atomics = rollback_atomics
+
+ def test_disallowed_database_queries(self):
+ message = (
+ "Database queries to 'other' are not allowed in this test. "
+ "Add 'other' to test_utils.test_testcase.TestTestCase.databases to "
+ "ensure proper test isolation and silence this failure."
+ )
+ with self.assertRaisesMessage(AssertionError, message):
+ Car.objects.using('other').get()