Opened 4 months ago

Closed 4 months ago

#9378 release blocker: regression closed fixed (fixed)

`trial -jN ...` crashes if a test fails with a non-ASCII failure

Reported by: Jean-Paul Calderone Owned by: Jean-Paul Calderone <exarkun@…>
Priority: normal Milestone:
Component: trial Keywords:
Cc: Branch:
Author:

Description

Unhandled Error
Traceback (most recent call last):
  File ".../site-packages/twisted/protocols/amp.py", line 1043, in _commandReceived
    deferred = self.dispatchCommand(box)
  File ".../site-packages/twisted/protocols/amp.py", line 1101, in dispatchCommand
    return maybeDeferred(responder, box)
  File ".../site-packages/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File ".../site-packages/twisted/protocols/amp.py", line 1188, in doit
    return maybeDeferred(aCallable, **kw).addCallback(
--- <exception caught here> ---
  File ".../site-packages/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File ".../site-packages/twisted/trial/_dist/worker.py", line 50, in run
    suite.run(self._result)
  File ".../site-packages/twisted/trial/runner.py", line 230, in run
    TestSuite.run(self, result)
  File ".../site-packages/twisted/trial/_asyncrunner.py", line 38, in run
    test(result)
  File "/usr/lib/python2.7/unittest/suite.py", line 70, in __call__
    return self.run(*args, **kwds)
  File ".../site-packages/twisted/trial/runner.py", line 189, in run
    super(LoggedSuite, self).run(result)
  File ".../site-packages/twisted/trial/_asyncrunner.py", line 38, in run
    test(result)
  File ".../site-packages/unittest2/case.py", line 673, in __call__
    return self.run(*args, **kwds)
  File ".../site-packages/testtools/testcase.py", line 671, in run
    return run_test.run(result)
  File ".../site-packages/testtools/runtest.py", line 80, in run
    return self._run_one(actual_result)
  File ".../site-packages/testtools/runtest.py", line 94, in _run_one
    return self._run_prepared_result(ExtendedToOriginalDecorator(result))
  File ".../site-packages/testtools/runtest.py", line 115, in _run_prepared_result
    handler(self.case, self.result, e)
  File ".../site-packages/testtools/testcase.py", line 634, in _report_failure
    result.addFailure(self, details=self.getDetails())
  File ".../site-packages/testtools/testresult/real.py", line 1404, in addFailure
    return self.decorated.addFailure(test, err)
  File ".../site-packages/twisted/trial/_dist/workerreporter.py", line 100, in addFailure
    fail = failure.getErrorMessage().encode("utf-8")
exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 52: ordinal not in range(128)

Change History (5)

comment:1 Changed 4 months ago by Jean-Paul Calderone

Keywords: review added

comment:2 Changed 4 months ago by Jean-Paul Calderone

Note: This behavior is a regression introduced by #8943 / 5b5e04a02faea2be936d9d36617d5958c7a321cb which replaced a bare failure.getErrorMessage() call with failure.getErrorMessage().encode("utf-8").

comment:3 Changed 4 months ago by Jean-Paul Calderone

Type: defectrelease blocker: regression

comment:5 Changed 4 months ago by Jean-Paul Calderone <exarkun@…>

Owner: set to Jean-Paul Calderone <exarkun@…>
Resolution: fixed
Status: newclosed

In c164919:

Merge pull request #959 from twisted/9378.disttrial-vs-non-ascii-bytes

Author: exarkun
Reviewer: adiroiban, markrwilliams
Fixes: ticket:9378

On Python 2, avoid calling str.encode on exception messages for disttrial failures. This avoids implicitly decoding them as ASCII which sometimes fails.

Note: See TracTickets for help on using tickets.