mirror of
https://github.com/django/django.git
synced 2025-10-25 14:46:09 +00:00
Fixed db backend discovery in admin_scripts tests.
Not all backends have dots in them.
This commit is contained in:
committed by
Tim Graham
parent
856072dd4a
commit
60f5129076
@@ -112,11 +112,10 @@ class AdminScriptTestCase(unittest.TestCase):
|
|||||||
Returns the paths for any external backend packages.
|
Returns the paths for any external backend packages.
|
||||||
"""
|
"""
|
||||||
paths = []
|
paths = []
|
||||||
first_package_re = re.compile(r'(^[^\.]+)\.')
|
|
||||||
for backend in settings.DATABASES.values():
|
for backend in settings.DATABASES.values():
|
||||||
result = first_package_re.findall(backend['ENGINE'])
|
package = backend['ENGINE'].split('.')[0]
|
||||||
if result and result != ['django']:
|
if package != 'django':
|
||||||
backend_pkg = __import__(result[0])
|
backend_pkg = __import__(package)
|
||||||
backend_dir = os.path.dirname(backend_pkg.__file__)
|
backend_dir = os.path.dirname(backend_pkg.__file__)
|
||||||
paths.append(os.path.dirname(backend_dir))
|
paths.append(os.path.dirname(backend_dir))
|
||||||
return paths
|
return paths
|
||||||
|
|||||||
Reference in New Issue
Block a user