From 60f51290766dae16abfb60459940de51fa5c5b2f Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Wed, 10 May 2017 15:47:20 +0200 Subject: [PATCH] Fixed db backend discovery in admin_scripts tests. Not all backends have dots in them. --- tests/admin_scripts/tests.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index 88e547a8c2..fa7f9e060e 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -112,11 +112,10 @@ class AdminScriptTestCase(unittest.TestCase): Returns the paths for any external backend packages. """ paths = [] - first_package_re = re.compile(r'(^[^\.]+)\.') for backend in settings.DATABASES.values(): - result = first_package_re.findall(backend['ENGINE']) - if result and result != ['django']: - backend_pkg = __import__(result[0]) + package = backend['ENGINE'].split('.')[0] + if package != 'django': + backend_pkg = __import__(package) backend_dir = os.path.dirname(backend_pkg.__file__) paths.append(os.path.dirname(backend_dir)) return paths