[TIP] unittest2/nose2: plugin interaction or overrides or ... ?

jason pellerin jpellerin at gmail.com
Fri Sep 24 07:31:15 PDT 2010


On Fri, Sep 17, 2010 at 2:38 PM, Michael Foord
<fuzzyman at voidspace.org.uk> wrote:
>  On 07/09/2010 14:26, jason pellerin wrote:
>>
>> On Fri, Sep 3, 2010 at 7:41 PM, Michael Foord<fuzzyman at voidspace.org.uk>
>>  wrote:
>>
>>> For logging capture, does the new reporting API not make it easy to
>>> attach
>>> extra information to test failure reports?
>>
>> It makes it easy to attach it, but not so easy to get it back out in
>> the right place. TextTestResult.printErrorList doesn't look at the
>> report metadata, so a plugin wanting to add custom output has to
>> squish it onto the end of report.traceback. It would be nicer and
>> cleaner if we didn't have to do that, if for instance printErrors and
>> printErrorList and the report event had direct support for metadata
>> meant to be printed.
>
> But in the end do you want to do anything more complex than attaching extra
> information to the end of a traceback? <0.5 wink>

Having actually tried this, sticking stuff to event.traceback doesn't
work. :( It looks like event.traceback is only used for reporting of
non-standard outcomes. I'm not sure if that's intentional or not.

You can see how I'm doing things in the logcapture plugin in nose2:

https://bitbucket.org/jpellerin/nose2/src/tip/nose2/plugins/logcapture.py#cl-51

That *looks* like it ought to work (though I still think sticking
non-traceback stuff onto the traceback is ... unclean) but nothing
comes out in the reports.

JP



More information about the testing-in-python mailing list