nose-devs/nose — Issue #135: ResultProxy._prepareErr mangles error output in some cases.
Author: jpellerin
Created: 2011-12-14 16:01:19+00:00
State: open

What steps will reproduce the problem?

1. Create a test that prints or logs some output and then raises a KeyError.
2. Run nose

What is the expected output?

Nicely formatted output with exception type/value on one line followed by lines of print and logging output. Example:

KeyError: 'fake!'
-------------------- >> begin captured stdout << ---------------------
something

--------------------- >> end captured stdout << ----------------------

What do you see instead?

Mangled exception value. The value of the KeyError contains logging and/or print output. Example:

KeyError: u"'fake!'\n-------------------- >> begin captured stdout << ---------------------\nsomething\n\n--------------------- >> end captured stdout << ----------------------"

What version of the product are you using? On what operating system?

Nose 1.1.2 (same result on 1.1.3dev), Python 2.7, Mac OS X 10.7

Please provide any additional information below.

See attached patch, which solves the problem with the default plugins (stdout and logging capture). This patch could potentially present a problem if some other plugin expected an exception value that had the same type as the original exception, but I think that's a significantly far-out edge case since the exception value has already been mangled and possibly changed to Exception type by ResultProxy._prepareErr

Google Code Info:
Issue #: 475
Author: miller...@gmail.com
Created On: 2011-12-02T17:43:07.000Z
Closed On: