mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +00:00
[soc2009/multidb] Fixed running the admin_scripts tests under sqlite without having DATABASE_NAME set
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11078 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
03fbc3f25d
commit
b4e069fab4
@ -38,7 +38,7 @@ connections = ConnectionHandler(settings.DATABASES)
|
||||
# we load all these up for backwards compatibility, you should use
|
||||
# connections['default'] instead.
|
||||
connection = connections['default']
|
||||
backend = load_backend(settings.DATABASE_ENGINE)
|
||||
backend = load_backend(connection.settings_dict['DATABASE_ENGINE'])
|
||||
DatabaseError = backend.DatabaseError
|
||||
IntegrityError = backend.IntegrityError
|
||||
|
||||
|
@ -23,17 +23,15 @@ class AdminScriptTestCase(unittest.TestCase):
|
||||
settings_file = open(os.path.join(test_dir, filename), 'w')
|
||||
settings_file.write('# Settings file automatically generated by regressiontests.admin_scripts test case\n')
|
||||
exports = [
|
||||
'DATABASE_ENGINE',
|
||||
'DATABASE_NAME',
|
||||
'DATABASE_USER',
|
||||
'DATABASE_PASSWORD',
|
||||
'DATABASE_HOST',
|
||||
'DATABASE_PORT',
|
||||
'DATABASES',
|
||||
'ROOT_URLCONF'
|
||||
]
|
||||
for s in exports:
|
||||
if hasattr(settings, s):
|
||||
settings_file.write("%s = '%s'\n" % (s, str(getattr(settings,s))))
|
||||
o = getattr(settings, s)
|
||||
if not isinstance(o, dict):
|
||||
o = "'%s'" % o
|
||||
settings_file.write("%s = %s\n" % (s, o))
|
||||
|
||||
if apps is None:
|
||||
apps = ['django.contrib.auth', 'django.contrib.contenttypes', 'admin_scripts']
|
||||
|
Loading…
x
Reference in New Issue
Block a user