[issue8313] message in unittest tracebacks

2011-12-23 Thread Michael Foord
Michael Foord added the comment: traceback patch looks good. Thanks for the unittest2 patch as well. -- ___ Python tracker ___ ___ Pyt

[issue8313] message in unittest tracebacks

2011-12-22 Thread Gregory P. Smith
Gregory P. Smith added the comment: We're on python 2.6, otherwise this would be a moot point. but you might want to include something like that in a new unittest2 backport release. -- ___ Python tracker

[issue8313] message in unittest tracebacks

2011-12-22 Thread Gregory P. Smith
Gregory P. Smith added the comment: http://pypi.python.org/pypi/unittest2 says "There are several places in unittest2 (and unittest) that call str(...) on exceptions to get the exception message. This can fail if the exception was created with non-ascii unicode. This is rare and I won't addr

[issue8313] message in unittest tracebacks

2010-05-05 Thread STINNER Victor
STINNER Victor added the comment: Commited: r80777 (trunk) and r80779 (2.6); blocked: r80778 (py3k). Open a new issue if you would like to use something better than ASCII+backslashreplace in unittest (using runner stream encoding?). -- resolution: -> fixed status: open -> closed ___

[issue8313] message in unittest tracebacks

2010-05-05 Thread Michael Foord
Michael Foord added the comment: I would prefer to try str(...) first and only attempt to convert to unicode and do the backslash replace if the str(...) call fails. -- ___ Python tracker _

[issue8313] message in unittest tracebacks

2010-05-05 Thread Michael Foord
Changes by Michael Foord : -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/opt

[issue8313] message in unittest tracebacks

2010-05-05 Thread Michael Foord
Michael Foord added the comment: Changing traceback._some_str to return unicode rather than str seems like a bad idea. -- ___ Python tracker ___

[issue8313] message in unittest tracebacks

2010-05-04 Thread STINNER Victor
STINNER Victor added the comment: > The downside of using backslashreplace (or repr, for that matter) is > that it does not preserve lengths, so the diff markers can get > misaligned. I find that an acceptable tradeoff, but 'replace' is > another option that preserves lengths, at least more ofte

[issue8313] message in unittest tracebacks

2010-05-04 Thread STINNER Victor
STINNER Victor added the comment: Attached patch fixes _some_str() function of the traceback module: encode unicode exception message to ASCII using backslashreplace error handler. ASCII is not the best choice, but str(unicode(...)) uses also ASCII (the default encoding) and we don't know the

[issue8313] message in unittest tracebacks

2010-05-04 Thread STINNER Victor
STINNER Victor added the comment: > Very recently, issue8533 changed regrtest.py to use > 'backslashreplace' when printing errors. This issue seems > very similar Issue #8533 is not directly related because in this issue the error occurs before writing the traceback to the terminal.

[issue8313] message in unittest tracebacks

2010-05-04 Thread STINNER Victor
STINNER Victor added the comment: The example raises an AssertionError(u'\n- \ufffd+ \ufffd\ufffd') which is converted to string by traceback.format_exception(). This function fails in _some_str() on str(value) instruction. You can reproduce the error with: >>> str(AssertionError(u"\xe9")) Un

[issue8313] message in unittest tracebacks

2010-05-04 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Very recently, issue8533 changed regrtest.py to use 'backslashreplace' when printing errors. This issue seems very similar -- nosy: +amaury.forgeotdarc, haypo ___ Python tracker

[issue8313] message in unittest tracebacks

2010-05-04 Thread Michael Foord
Michael Foord added the comment: Sounds like a good solution - I'll look at this, thanks. -- ___ Python tracker ___ ___ Python-bugs-li

[issue8313] message in unittest tracebacks

2010-05-04 Thread Gunnlaugur Thor Briem
Gunnlaugur Thor Briem added the comment: Replacing the message with its repr seems to me at least strongly preferable to the current “hide it all” behavior. :) Better, msg.encode('ascii', 'backslashreplace') does what repr does with unencodable characters, but does not add the quotes, so the

[issue8313] message in unittest tracebacks

2010-04-05 Thread Michael Foord
New submission from Michael Foord : >>> import unittest >>> class Foo(unittest.TestCase): ... def test_fffd(self): self.assertEqual(u'\ufffd', u'\ufffd\ufffd') ... >>> unittest.main(exit=False) F == FAIL: test_fffd (__main__.Fo