Comment 2 for bug 501169

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 501169] [NEW] testtools should pass the real exc_info to TestResult methods

On Mon, 2009-12-28 at 23:50 +0000, Martin [gz] wrote:
> Public bug reported:
>
> TestResult methods designed for overriding such as addFailure and
> report_failure get a (nearly useless) _StringException instance and no
> traceback object from the err parameter, rather than the actual exc_info
> from the test. Have not been able to work out what exactly is going on
> here yet, but it seems the current behaviour has nothing to recommend
> it.

There is no requirement that the exc info get an AssertionError: the
exc_info protocol is fairly well understood, and the standard
stringification logic in the standard library works on the objects
passed in.

report_failure is a bzrlibism - note that bzrlib is now using the
extended details API that testtools offers: the 'real exc_info' is
discarded many stages earlier and the exception is being reconstitued
Just-In-Time for whatever down-level reporter you are using. (Note that
some methods in bzrlib haven't been upgraded yet).

We could put some effort into passing the real exc_info across but I
would consider this rather pointless: for bzrlib, which I believe you
are working on, this won't help with subunit (using in bzr selftest
--parallel), as subunit is in a different process, so a 'real exc_info'
is never available.

In short, I don't consider this behaviour a bug, but if you wanted to
put a patch forward I could review it for you.

 status triaged
 importance wishlist