Menu

#1393 [FIX] UnitTest console capture does not escape characters

pending
debugger (210)
5
2011-09-28
2011-09-27
Anonymous
No

On a French installation of Windows XP, when a unit test fails because of a low-level system message that contains accented characters, the debugger fails to escaoe the characters, causing a later XML-RPC encoding error.
A typical message is the 'Connection denied', which in french is:
"[Errno 10061]: Aucune connexion n'a pu être établie car l'ordinateur cible l'a expressément refusée"
Note the 'é' and 'ê' accented characters.

The origin seems to be in PyDevTestResult.stopTest, in file pydev_runfiles_unittest.py, at line 68, where:
captured_output = self.bug.getvalue()
does not escape non-ascii characters.

I added the following line immediately after line 68, which fixed the problem (for me):
captured_output = captured_output.decode(sys.getdefaultencoding(), 'replace')

Discussion

  • Fabio Zadrozny

    Fabio Zadrozny - 2011-09-28

    Can you attach the actual stack-trace you have? (I'd like to reproduce it here before actually applying the fix, but I still haven't been able to reproduce it -- even with accents in the error, things seem to work).

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2011-09-28
    • status: open --> pending
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.