Loading tests/i18n/test_compilation.py +17 −16 Original line number Diff line number Diff line Loading @@ -165,14 +165,15 @@ class CompilationErrorHandling(MessageCompilationTests): with self.assertRaises(CommandError): call_command('compilemessages', locale=['ja'], verbosity=0) # We will check the output of msgfmt, so we need to make sure its output # is unaffected by the current locale. @mock.patch('django.core.management.utils.Popen', lambda *args, **kwargs: Popen(*args, env={'LANG': 'C'}, **kwargs)) def test_msgfmt_error_including_non_ascii(self): # po file contains invalid msgstr content (triggers non-ascii error content). mo_file = 'locale/ko/LC_MESSAGES/django.mo' self.addCleanup(self.rmfile, os.path.join(self.test_dir, mo_file)) # Make sure the output of msgfmt is unaffected by the current locale. env = os.environ.copy() env.update({'LANG': 'C'}) with mock.patch('django.core.management.utils.Popen', lambda *args, **kwargs: Popen(*args, env=env, **kwargs)): if six.PY2: # Various assertRaises on PY2 don't support unicode error messages. try: Loading Loading
tests/i18n/test_compilation.py +17 −16 Original line number Diff line number Diff line Loading @@ -165,14 +165,15 @@ class CompilationErrorHandling(MessageCompilationTests): with self.assertRaises(CommandError): call_command('compilemessages', locale=['ja'], verbosity=0) # We will check the output of msgfmt, so we need to make sure its output # is unaffected by the current locale. @mock.patch('django.core.management.utils.Popen', lambda *args, **kwargs: Popen(*args, env={'LANG': 'C'}, **kwargs)) def test_msgfmt_error_including_non_ascii(self): # po file contains invalid msgstr content (triggers non-ascii error content). mo_file = 'locale/ko/LC_MESSAGES/django.mo' self.addCleanup(self.rmfile, os.path.join(self.test_dir, mo_file)) # Make sure the output of msgfmt is unaffected by the current locale. env = os.environ.copy() env.update({'LANG': 'C'}) with mock.patch('django.core.management.utils.Popen', lambda *args, **kwargs: Popen(*args, env=env, **kwargs)): if six.PY2: # Various assertRaises on PY2 don't support unicode error messages. try: Loading