mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #33278 -- Improved error for connection/query attempts against disallowed databases in tests.
This commit is contained in:
parent
560ff988dd
commit
76f07b4fcf
4 changed files with 16 additions and 10 deletions
|
@ -2,6 +2,7 @@ from unittest import mock
|
|||
|
||||
from django.db import connections
|
||||
from django.test import TestCase, TransactionTestCase, override_settings
|
||||
from django.test.testcases import DatabaseOperationForbidden
|
||||
|
||||
from .models import Car
|
||||
|
||||
|
@ -58,5 +59,5 @@ class DisallowedDatabaseQueriesTests(TransactionTestCase):
|
|||
"DisallowedDatabaseQueriesTests.databases to ensure proper test "
|
||||
"isolation and silence this failure."
|
||||
)
|
||||
with self.assertRaisesMessage(AssertionError, message):
|
||||
with self.assertRaisesMessage(DatabaseOperationForbidden, message):
|
||||
Car.objects.using('other').get()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue