Fixed #25925 -- Forced LANG=C for test_msgfmt_error_including_non_ascii.

This commit is contained in:
Sergey Fedoseev 2015-12-13 19:15:56 +05:00 committed by Claude Paroz
parent ed20dd2e85
commit 5005b527cb
1 changed files with 6 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import os
import shutil
import stat
import unittest
from subprocess import Popen
from django.core.management import (
CommandError, call_command, execute_from_command_line,
@ -13,7 +14,7 @@ from django.core.management import (
from django.core.management.commands.makemessages import \
Command as MakeMessagesCommand
from django.core.management.utils import find_command
from django.test import SimpleTestCase, override_settings
from django.test import SimpleTestCase, mock, override_settings
from django.test.utils import captured_stderr, captured_stdout
from django.utils import six, translation
from django.utils._os import upath
@ -164,6 +165,10 @@ 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'