Merge lp:~gz/testtools/avoid_exception_unicode_method_bug_689858 into lp:~testtools-committers/testtools/trunk

Proposed by Martin Packman
Status: Merged
Merged at revision: 161
Proposed branch: lp:~gz/testtools/avoid_exception_unicode_method_bug_689858
Merge into: lp:~testtools-committers/testtools/trunk
Diff against target: 12 lines (+2/-0)
1 file modified
testtools/tests/test_testresult.py (+2/-0)
To merge this branch: bzr merge lp:~gz/testtools/avoid_exception_unicode_method_bug_689858
Reviewer Review Type Date Requested Status
testtools developers Pending
Review via email: mp+43967@code.launchpad.net

Description of the change

This resolves a failure jam was having on Python 2.6.4 that I couldn't reproduce on Python 2.6.6 or 2.7 - it seems there was a broken __unicode__ method added to the Exception class which has since been removed again. As the test is just trying to make sure that the exception serialisation doesn't propagate stringification errors, overriding __unicode__ to raise as well should be enough.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

The problem versions are 2.6.0 -> 2.6.4 which have a very odd BaseException.__unicode__ method that instead of deferring to __str__ does its own thing:
<http://bugs.python.org/issue6108#msg96281>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'testtools/tests/test_testresult.py'
2--- testtools/tests/test_testresult.py 2010-12-04 21:04:26 +0000
3+++ testtools/tests/test_testresult.py 2010-12-16 20:23:52 +0000
4@@ -1230,6 +1230,8 @@
5 "class UnprintableError(Exception):\n"
6 " def __str__(self):\n"
7 " raise RuntimeError\n"
8+ " def __unicode__(self):\n"
9+ " raise RuntimeError\n"
10 " def __repr__(self):\n"
11 " raise RuntimeError\n")
12 textoutput = self._test_external_case(

Subscribers

People subscribed via source and target branches