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
|
# we load all these up for backwards compatibility, you should use
|
||||||
# connections['default'] instead.
|
# connections['default'] instead.
|
||||||
connection = connections['default']
|
connection = connections['default']
|
||||||
backend = load_backend(settings.DATABASE_ENGINE)
|
backend = load_backend(connection.settings_dict['DATABASE_ENGINE'])
|
||||||
DatabaseError = backend.DatabaseError
|
DatabaseError = backend.DatabaseError
|
||||||
IntegrityError = backend.IntegrityError
|
IntegrityError = backend.IntegrityError
|
||||||
|
|
||||||
|
@ -23,17 +23,15 @@ class AdminScriptTestCase(unittest.TestCase):
|
|||||||
settings_file = open(os.path.join(test_dir, filename), 'w')
|
settings_file = open(os.path.join(test_dir, filename), 'w')
|
||||||
settings_file.write('# Settings file automatically generated by regressiontests.admin_scripts test case\n')
|
settings_file.write('# Settings file automatically generated by regressiontests.admin_scripts test case\n')
|
||||||
exports = [
|
exports = [
|
||||||
'DATABASE_ENGINE',
|
'DATABASES',
|
||||||
'DATABASE_NAME',
|
|
||||||
'DATABASE_USER',
|
|
||||||
'DATABASE_PASSWORD',
|
|
||||||
'DATABASE_HOST',
|
|
||||||
'DATABASE_PORT',
|
|
||||||
'ROOT_URLCONF'
|
'ROOT_URLCONF'
|
||||||
]
|
]
|
||||||
for s in exports:
|
for s in exports:
|
||||||
if hasattr(settings,s):
|
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:
|
if apps is None:
|
||||||
apps = ['django.contrib.auth', 'django.contrib.contenttypes', 'admin_scripts']
|
apps = ['django.contrib.auth', 'django.contrib.contenttypes', 'admin_scripts']
|
||||||
@ -523,7 +521,7 @@ class DjangoAdminSettingsDirectory(AdminScriptTestCase):
|
|||||||
A series of tests for django-admin.py when the settings file is in a
|
A series of tests for django-admin.py when the settings file is in a
|
||||||
directory. (see #9751).
|
directory. (see #9751).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.write_settings('settings', is_dir=True)
|
self.write_settings('settings', is_dir=True)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user