Kaydet (Commit) 9d410ee6 authored tarafından Julien Phalip's avatar Julien Phalip

Fixed #17197 -- Prevented a locale leakage from an i18n test causing collateral…

Fixed #17197 -- Prevented a locale leakage from an i18n test causing collateral failures in the rest of the test suite. Thanks to Florian Apolloner for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17080 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst 64fdd844
...@@ -6,7 +6,7 @@ from os import path ...@@ -6,7 +6,7 @@ from os import path
from django.conf import settings from django.conf import settings
from django.test import TestCase from django.test import TestCase
from django.utils.translation import override, activate from django.utils.translation import override, activate, get_language
from django.utils.text import javascript_quote from django.utils.text import javascript_quote
from ..urls import locale_dir from ..urls import locale_dir
...@@ -25,6 +25,7 @@ class I18NTests(TestCase): ...@@ -25,6 +25,7 @@ class I18NTests(TestCase):
def test_jsi18n(self): def test_jsi18n(self):
"""The javascript_catalog can be deployed with language settings""" """The javascript_catalog can be deployed with language settings"""
saved_lang = get_language()
for lang_code in ['es', 'fr', 'ru']: for lang_code in ['es', 'fr', 'ru']:
activate(lang_code) activate(lang_code)
catalog = gettext.translation('djangojs', locale_dir, [lang_code]) catalog = gettext.translation('djangojs', locale_dir, [lang_code])
...@@ -37,6 +38,7 @@ class I18NTests(TestCase): ...@@ -37,6 +38,7 @@ class I18NTests(TestCase):
if lang_code == 'fr': if lang_code == 'fr':
# Message with context (msgctxt) # Message with context (msgctxt)
self.assertContains(response, "['month name\x04May'] = 'mai';", 1) self.assertContains(response, "['month name\x04May'] = 'mai';", 1)
activate(saved_lang)
class JsI18NTests(TestCase): class JsI18NTests(TestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment