Tidied djang.db.utils.load_backend().

Removed an unneeded EnvironmentError catching and used
"raise from exc" syntax.
This commit is contained in:
Tim Graham 2017-01-24 08:33:26 -05:00 committed by GitHub
parent 435e4bf38e
commit a87d6b69a7
2 changed files with 14 additions and 18 deletions

View file

@ -8,8 +8,8 @@ class TestLoadBackend(SimpleTestCase):
msg = (
"'foo' isn't an available database backend.\n"
"Try using 'django.db.backends.XXX', where XXX is one of:\n"
" 'mysql', 'oracle', 'postgresql', 'sqlite3'\n"
"Error was: No module named 'foo'"
" 'mysql', 'oracle', 'postgresql', 'sqlite3'"
)
with self.assertRaisesMessage(ImproperlyConfigured, msg):
with self.assertRaisesMessage(ImproperlyConfigured, msg) as cm:
load_backend('foo')
self.assertEqual(str(cm.exception.__cause__), "No module named 'foo'")