#26673 closed Bug (fixed)
i18n tests: Unicode in enviroment vars isn't accepted on Python2+Windows
| Reported by: | Ramiro Morales | Owned by: | Ramiro Morales |
|---|---|---|---|
| Component: | Internationalization | Version: | dev |
| Severity: | Normal | Keywords: | windows i18n |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Starting with 5005b527 and eda306f1 we are adding uLANG=C to the enviroment on which a test case (i18n.test_compilation.CompilationErrorHandling.test_msgfmt_error_including_non_ascii) is run.
On Windows + Python 2.7 this is causing the following error:
======================================================================
ERROR: test_msgfmt_error_including_non_ascii (i18n.test_compilation.CompilationErrorHandling)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\django\upstream\tests\i18n\test_compilation.py", line 179, in test_msgfmt_error_including_non_ascii
call_command('compilemessages', locale=['ko'], verbosity=0)
File "C:\django\upstream\django\core\management\__init__.py", line 130, in call_command
return command.execute(*args, **defaults)
File "C:\django\upstream\django\core\management\base.py", line 356, in execute
output = self.handle(*args, **options)
File "C:\django\upstream\django\core\management\commands\compilemessages.py", line 103, in handle
self.compile_messages(locations)
File "C:\django\upstream\django\core\management\commands\compilemessages.py", line 128, in compile_messages
output, errors, status = popen_wrapper(args)
File "C:\django\upstream\django\core\management\utils.py", line 21, in popen_wrapper
p = Popen(args, shell=False, stdout=PIPE, stderr=PIPE, close_fds=os.name != 'nt')
File "C:\django\upstream\tests\i18n\test_compilation.py", line 175, in <lambda>
with mock.patch('django.core.management.utils.Popen', lambda *args, **kwargs: Popen(*args, env=env, **kwargs)):
File "C:\py27-64\Lib\subprocess.py", line 710, in __init__
errread, errwrite)
File "C:\py27-64\Lib\subprocess.py", line 958, in execute_child
startupinfo)
TypeError: environment can only contain strings
This is caused by the fact that this Python version+OS combination needs bytestrings as env var value and name (at least Python 2.7 on Linux doesn't seem to be as picky).
This is related to our usage of from __future__ import unicode_literals on that module.
Other projects faced similar problems:
Change History (4)
comment:1 by , 9 years ago
| Keywords: | windows i18n added |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
comment:2 by , 9 years ago
| Has patch: | set |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
PR