bobber6467 / python-nose

Automatically exported from code.google.com/p/python-nose
0 stars 0 forks source link

ResultProxy._prepareErr mangles error output in some cases. #475

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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

Original issue reported on code.google.com by miller...@gmail.com on 2 Dec 2011 at 5:43

Attachments:

GoogleCodeExporter commented 8 years ago
I also see this problem with Python 2.7.3 on Ubuntu 12.04 with nose 1.1.2.

Original comment by jdb...@vs-networks.com on 23 May 2012 at 6:46

GoogleCodeExporter commented 8 years ago
I also see this problem, on multiple platforms. The patch works. This issue is 
almost 1 year old. Can anyone fix it?

Original comment by arn...@infinidat.com on 28 Aug 2012 at 8:53