Changed runtests.py to set USE_I18N=True during test running, because the template tests assume it. Some template tests were failing because my personal settings have USE_I18N=False
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4206 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6001974e45
commit
cfb1c5feff
|
@ -71,20 +71,24 @@ class InvalidModelTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def django_tests(verbosity, tests_to_run):
|
def django_tests(verbosity, tests_to_run):
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models.loading import get_apps, load_app
|
|
||||||
|
|
||||||
old_installed_apps = settings.INSTALLED_APPS
|
old_installed_apps = settings.INSTALLED_APPS
|
||||||
old_test_database_name = settings.TEST_DATABASE_NAME
|
old_test_database_name = settings.TEST_DATABASE_NAME
|
||||||
old_root_urlconf = settings.ROOT_URLCONF
|
old_root_urlconf = settings.ROOT_URLCONF
|
||||||
old_template_dirs = settings.TEMPLATE_DIRS
|
old_template_dirs = settings.TEMPLATE_DIRS
|
||||||
|
old_use_i18n = settings.USE_I18N
|
||||||
|
|
||||||
# Redirect some settings for the duration of these tests
|
# Redirect some settings for the duration of these tests
|
||||||
settings.TEST_DATABASE_NAME = TEST_DATABASE_NAME
|
settings.TEST_DATABASE_NAME = TEST_DATABASE_NAME
|
||||||
settings.INSTALLED_APPS = ALWAYS_INSTALLED_APPS
|
settings.INSTALLED_APPS = ALWAYS_INSTALLED_APPS
|
||||||
settings.ROOT_URLCONF = 'urls'
|
settings.ROOT_URLCONF = 'urls'
|
||||||
settings.TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), TEST_TEMPLATE_DIR),)
|
settings.TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), TEST_TEMPLATE_DIR),)
|
||||||
|
settings.USE_I18N = True
|
||||||
|
|
||||||
# load all the ALWAYS_INSTALLED_APPS
|
# Load all the ALWAYS_INSTALLED_APPS.
|
||||||
|
# (This import statement is intentionally delayed until after we
|
||||||
|
# access settings because of the USE_I18N dependency.)
|
||||||
|
from django.db.models.loading import get_apps, load_app
|
||||||
get_apps()
|
get_apps()
|
||||||
|
|
||||||
# Load all the test model apps
|
# Load all the test model apps
|
||||||
|
@ -121,6 +125,7 @@ def django_tests(verbosity, tests_to_run):
|
||||||
settings.TESTS_DATABASE_NAME = old_test_database_name
|
settings.TESTS_DATABASE_NAME = old_test_database_name
|
||||||
settings.ROOT_URLCONF = old_root_urlconf
|
settings.ROOT_URLCONF = old_root_urlconf
|
||||||
settings.TEMPLATE_DIRS = old_template_dirs
|
settings.TEMPLATE_DIRS = old_template_dirs
|
||||||
|
settings.USE_I18N = old_use_i18n
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
Loading…
Reference in New Issue