mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #33278 -- Improved error for connection/query attempts against disallowed databases in tests.
This commit is contained in:
committed by
Mariusz Felisiak
parent
560ff988dd
commit
76f07b4fcf
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user