#22335: tests.user_commands.UtilsTests failure on non-English Windows systems --------------------------------------------+-------------------- Reporter: zsiciarz | Owner: nobody Type: Bug | Status: new Component: Core (Management commands) | Version: master Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 1 | UI/UX: 0 --------------------------------------------+-------------------- While working my way towards #22234, I've noticed that current master doesn't pass the test suite on Windows if the system language is other than English. This is the output from running that test on Windows 7 (Polish language, Python 2.7.2):
{{{ (django-dev) C:\Users\USER\v\django-dev\django\tests>python runtests.py user_commands.tests.UtilsTests Testing against Django installed in 'c:\users\user\v\django- dev\django\django' Creating test database for alias 'default'... Creating test database for alias 'other'... E ====================================================================== ERROR: test_no_existent_external_program (user_commands.tests.UtilsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\USER\v\django-dev\django\tests\user_commands\tests.py", line 81, in test_no_existent_external _program self.assertRaises(CommandError, popen_wrapper, ['a_42_command_that_doesnt_exist_42']) File "D:\Python27\Lib\unittest\case.py", line 471, in assertRaises callableObj(*args, **kwargs) File "c:\users\user\v\django- dev\django\django\core\management\utils.py", line 24, in popen_wrapper (args[0], e.strerror)), sys.exc_info()[2]) UnicodeDecodeError: 'ascii' codec can't decode byte 0xbf in position 6: ordinal not in range(128) ---------------------------------------------------------------------- Ran 1 test in 0.045s FAILED (errors=1) Destroying test database for alias 'default'... Destroying test database for alias 'other'... }}} This failure appears to be caused by a localized system error. The test expects that a `CommandError` is raised, saying that a program cannot be found. The actual error message is extracted from the original operating system error. On English Windows, the message says ''The system cannot find the file specified'' and the test passes. In case of Polish language, the error says ''Nie można odnaleźć określonego pliku'' (oops, non-ASCII characters here) and the test fails as seen above. Wrapping the system error with `force_text` should solve this problem. -- Ticket URL: <https://code.djangoproject.com/ticket/22335> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/051.fec60751f21b52f542442270aa74e64d%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.