nose-devs/nose — Issue #134: xunit and exceptions
Author: jpellerin
Created: 2011-12-14 16:01:18+00:00
State: open

What steps will reproduce the problem?
1. create the following test case :

def tests():
print("something")
raise IOError(42, "test")

2. launch the tests case with xunit plugin enabled (eg. "nosetests --with-xunit test.py)

What is the expected output? What do you see instead?
we expect the following report :

Traceback (most recent call last):
File "/usr/local/afs7/lib/python3.2/site-packages/nose/case.py", line 198, in runTest
self.test(*self.arg)
File "/users/jg/bug/test.py", line 3, in tests
raise IOError(42, "test")
IOError: IOError: 42
-------------------- >> begin captured stdout << ---------------------
something

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

instead we get a stacktrace from inside nosetests code :
Traceback (most recent call last):
File "/usr/local/afs7/lib/python3.2/site-packages/nose/case.py", line 134, in run
self.runTest(result)
File "/usr/local/afs7/lib/python3.2/site-packages/nose/case.py", line 152, in runTest
test(result)
File "/usr/local/afs7/lib/python3.2/unittest/case.py", line 494, in __call__
return self.run(*args, **kwds)
File "/usr/local/afs7/lib/python3.2/unittest/case.py", line 452, in run
result.addError(self, exc_info)
File "/usr/local/afs7/lib/python3.2/site-packages/nose/proxy.py", line 134, in addError
plugins.addError(self.test, err)
File "/usr/local/afs7/lib/python3.2/site-packages/nose/plugins/manager.py", line 98, in __call__
return self.call(*arg, **kw)
File "/usr/local/afs7/lib/python3.2/site-packages/nose/plugins/manager.py", line 166, in simple
result = meth(*arg, **kw)
File "/usr/local/afs7/lib/python3.2/site-packages/nose/plugins/xunit.py", line 201, in addError
tb = ''.join(traceback.format_exception(*err))
File "/usr/local/afs7/lib/python3.2/traceback.py", line 180, in format_exception
for value, tb in values:
File "/usr/local/afs7/lib/python3.2/traceback.py", line 122, in _iter_chain
cause = exc.__cause__
AttributeError: 'str' object has no attribute '__cause__'

What version of the product are you using? On what operating system?
python3.2, last nosetests revision

Additional details :
the error is caused by the print statement, without any output the test works fine.

Google Code Info:
Issue #: 469
Author: jean.giard@gmail.com
Created On: 2011-11-14T09:21:22.000Z
Closed On: