              "ensure proper test isolation or add 'default' to "
              "test_utils.tests.DisallowedDatabaseQueriesTests.databases to "
              "silence this failure."
          )
          with self.assertRaisesMessage(AssertionError, expected_message):
              next(Car.objects.iterator())
  
  
  class AllowedDatabaseQueriesTests(SimpleTestCase):
      databases = {'default'}
 
</s> remove         with self.assertRaisesMessage(AssertionError, expected_message):
 </s> add         with self.assertRaisesMessage(DatabaseOperationForbidden, expected_message): </s> remove         with self.assertRaisesMessage(AssertionError, expected_message):
 </s> add         with self.assertRaisesMessage(DatabaseOperationForbidden, expected_message): </s> remove         with self.assertRaisesMessage(AssertionError, expected_message):
 </s> add         with self.assertRaisesMessage(DatabaseOperationForbidden, expected_message): </s> remove         with self.assertRaisesMessage(AssertionError, message):
 </s> add         with self.assertRaisesMessage(DatabaseOperationForbidden, message): </s> remove         with self.assertRaisesMessage(AssertionError, message):
 </s> add         with self.assertRaisesMessage(DatabaseOperationForbidden, message):
        with self.assertRaisesMessage(DatabaseOperationForbidden, expected_message):
              "ensure proper test isolation or add 'default' to "
              "test_utils.tests.DisallowedDatabaseQueriesTests.databases to "
              "silence this failure."
          )
        with self.assertRaisesMessage(DatabaseOperationForbidden, expected_message):
              next(Car.objects.iterator())
  
  
  class AllowedDatabaseQueriesTests(SimpleTestCase):
      databases = {'default'}
keep keep keep keep replace keep keep keep keep keep
 Fixed #33278 -- Improved error for connection/query attempts against disallowed databases in tests. 
tests/test_utils/tests.py