Opened 2 years ago

Closed 2 years ago

#19942 closed Bug (fixed)

Test failure

Reported by: aaugustin Owned by: nobody
Component: Internationalization Version: master
Severity: Release blocker Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Since a few days (maybe since the modeltests/regressiontests merge) I'm seeing this failure when running the tests (OS X, Python 2.7):

======================================================================
ERROR: test_error_reported_by_msgfmt (i18n.commands.compilation.CompilationErrorHandling)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/myk/Documents/dev/django/tests/i18n/commands/compilation.py", line 113, in test_error_reported_by_msgfmt
    call_command('compilemessages', locale=self.LOCALE, stderr=StringIO())
  File "/Users/myk/Documents/dev/django/django/core/management/__init__.py", line 161, in call_command
    return klass.execute(*args, **defaults)
  File "/Users/myk/Documents/dev/django/django/core/management/base.py", line 283, in execute
    output = self.handle(*args, **options)
  File "/Users/myk/Documents/dev/django/django/core/management/commands/compilemessages.py", line 68, in handle
    compile_messages(self.stderr, locale=locale)
  File "/Users/myk/Documents/dev/django/django/core/management/commands/compilemessages.py", line 50, in compile_messages
    msg = "Execution of %s failed: %s" % (program, errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 94: ordinal not in range(128)

----------------------------------------------------------------------

Attachments (1)

19942-1.diff (780 bytes) - added by claudep 2 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 2 years ago by claudep

Hé hé... the French utf-8-encoded error message from msgfmt is disturbing you :-)

More seriously, we should decode the errors content that come from Popen.communicate, now that we have a nice wrapper for it (popen_wrapper). Are we going to assume a hard-coded 'utf-8' terminal encoding, or do we want to try being clever (not a problem on Py3). get_system_username taught us that it might reveal harder than expected...

comment:2 Changed 2 years ago by claudep

Might be another use case for django.utils.encoding.DEFAULT_LOCALE_ENCODING.

Changed 2 years ago by claudep

comment:3 Changed 2 years ago by claudep

  • Easy pickings set
  • Has patch set

comment:4 Changed 2 years ago by aaugustin

  • Triage Stage changed from Accepted to Ready for checkin

That fixes the failure I was seeing.

comment:5 Changed 2 years ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

In e4bf0f2c367ca77266900af3461e1ec440c8689d:

Fixed #19942 -- Decoded errors coming from Popen commands

Thanks Aymeric Augustin for reporting the issue.

Note: See TracTickets for help on using tickets.
Back to Top