diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-12-25 13:24:39 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-12-25 13:24:39 +0000 |
| commit | db2b1458b1fc83c8485687634934b7c4909cde78 (patch) | |
| tree | e17855d7814272e05601ed43d8948de17eaf640d /tests | |
| parent | ff1f423d29f431e732978ac44d2ad9d5a8917d17 (diff) | |
Fixed #17047 -- Improved django.db.utils.load_backend to raise a better exception when using a unqualified database backend name. Thanks, Jonas Obrist.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17274 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/backends/tests.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/regressiontests/backends/tests.py b/tests/regressiontests/backends/tests.py index bda604e00b..b561b4eb2d 100644 --- a/tests/regressiontests/backends/tests.py +++ b/tests/regressiontests/backends/tests.py @@ -7,11 +7,12 @@ import threading from django.conf import settings from django.core.management.color import no_style +from django.core.exceptions import ImproperlyConfigured from django.db import (backend, connection, connections, DEFAULT_DB_ALIAS, IntegrityError, transaction) from django.db.backends.signals import connection_created from django.db.backends.postgresql_psycopg2 import version as pg_version -from django.db.utils import ConnectionHandler, DatabaseError +from django.db.utils import ConnectionHandler, DatabaseError, load_backend from django.test import TestCase, skipUnlessDBFeature, TransactionTestCase from django.utils import unittest @@ -582,4 +583,11 @@ class ThreadTests(TestCase): t1.start() t1.join() # No exception was raised - self.assertEqual(len(exceptions), 0)
\ No newline at end of file + self.assertEqual(len(exceptions), 0) + + +class BackendLoadingTests(TestCase): + def test_old_style_backends_raise_useful_exception(self): + self.assertRaisesRegexp(ImproperlyConfigured, + "Try using django.db.backends.sqlite3 instead", + load_backend, 'sqlite3') |
