From 3c5d1edb39020f549c58e0696b8ab2f03a88d753 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 27 Dec 2014 16:19:32 +0100 Subject: [PATCH] Fixed #22279 -- Prevented dummy backend going through DatabaseErrorWrapper Thanks Daniel Hahler for the report and Tim Graham for the review. --- django/db/backends/dummy/base.py | 1 + tests/backends/tests.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/django/db/backends/dummy/base.py b/django/db/backends/dummy/base.py index 92075ac85e9..61a788e4339 100644 --- a/django/db/backends/dummy/base.py +++ b/django/db/backends/dummy/base.py @@ -60,6 +60,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): # do something raises complain; anything that tries # to rollback or undo something raises ignore. _cursor = complain + ensure_connection = complain _commit = complain _rollback = ignore _close = ignore diff --git a/tests/backends/tests.py b/tests/backends/tests.py index d25cde675a8..3eae1ac4d42 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -41,6 +41,8 @@ class DummyBackendTest(TestCase): conns = ConnectionHandler(DATABASES) self.assertEqual(conns[DEFAULT_DB_ALIAS].settings_dict['ENGINE'], 'django.db.backends.dummy') + with self.assertRaises(ImproperlyConfigured): + conns[DEFAULT_DB_ALIAS].ensure_connection() @unittest.skipUnless(connection.vendor == 'oracle', "Test only for Oracle")