diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-10-21 17:26:32 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-10-21 17:26:32 +0000 |
| commit | 3ec6568e64d14b6293e7e1b8df0987430ad20905 (patch) | |
| tree | f28c925f9bf2f671db0ff5656081aca27d26e603 | |
| parent | 7ca708140a723b42d915d98d9f9c633a77460089 (diff) | |
Modified the test harness to respect the LANGUAGE_CODE setting. Also changed
Django's own test runner to always use 'en' for LANGUAGE_CODE when testing
core. Fixed #4709
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6583 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/test/utils.py | 5 | ||||
| -rwxr-xr-x | tests/runtests.py | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/django/test/utils.py b/django/test/utils.py index 6edd186b54..51ca37e2f0 100644 --- a/django/test/utils.py +++ b/django/test/utils.py @@ -6,6 +6,7 @@ from django.core.management import call_command from django.dispatch import dispatcher from django.test import signals from django.template import Template +from django.utils.translation import deactivate # The prefix to put on the default database name when creating # the test database. @@ -43,7 +44,7 @@ def setup_test_environment(): - Installing the instrumented test renderer - Diverting the email sending functions to a test buffer - + - Setting the active locale to match the LANGUAGE_CODE setting. """ Template.original_render = Template.render Template.render = instrumented_test_render @@ -53,6 +54,8 @@ def setup_test_environment(): mail.outbox = [] + deactivate() + def teardown_test_environment(): """Perform any global post-test teardown. This involves: diff --git a/tests/runtests.py b/tests/runtests.py index 736a9a61b3..843850074b 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -93,6 +93,7 @@ def django_tests(verbosity, interactive, test_labels): old_root_urlconf = settings.ROOT_URLCONF old_template_dirs = settings.TEMPLATE_DIRS old_use_i18n = settings.USE_I18N + old_language_code = settings.LANGUAGE_CODE old_middleware_classes = settings.MIDDLEWARE_CLASSES # Redirect some settings for the duration of these tests. @@ -100,6 +101,7 @@ def django_tests(verbosity, interactive, test_labels): settings.ROOT_URLCONF = 'urls' settings.TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), TEST_TEMPLATE_DIR),) settings.USE_I18N = True + settings.LANGUAGE_CODE = 'en' settings.MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', @@ -151,6 +153,7 @@ def django_tests(verbosity, interactive, test_labels): settings.ROOT_URLCONF = old_root_urlconf settings.TEMPLATE_DIRS = old_template_dirs settings.USE_I18N = old_use_i18n + settings.LANGUAGE_CODE = old_language_code settings.MIDDLEWARE_CLASSES = old_middleware_classes if __name__ == "__main__": |
