[TIP] testing unittest2 plugin branch Was: How to get coverage.py and unittest2 working together?

Michael Foord fuzzyman at voidspace.org.uk
Thu Jul 29 08:41:32 PDT 2010

On 29/07/2010 14:33, Jorge Vargas wrote:
> On Thu, Jul 29, 2010 at 7:17 AM, Michael Foord
> <fuzzyman at voidspace.org.uk>  wrote:
>> On 29/07/2010 03:53, Jorge Vargas wrote:
>>> [snip...]
>>>> I've pushed a few fixes for the coverage module in particular, so you
>>>> should
>>>> update (and report any *new* problems).
>>> Seems like there is a problem with the event, as it is not triggering?
>>>    File "......./src/unittest2/unittest2/plugins/testcoverage.py", line
>>> 77, in stopTestRun
>>>      self.cov.stop()
>>> AttributeError: 'CoveragePlugin' object has no attribute 'cov'
>> Man that was a difficult bug to track down, thanks for the report (now
>> fixed). The issues was event handlers removing themselves during an event
>> (mutating the list of handlers whilst it is being iterated over to trigger
>> all the handlers - the code now iterates over a copy of the list of
>> handlers).
> Judging from the changelog it is indeed weird :) and it is indeed fixed!
> Here is some progress instead of a bug report :D a little patch to add
> annotations to the coverage plugin
> http://paste.ofcode.org/NwuzWeEW4DB7W5raaac4tr
Committed with a minor change. Annotate is only called if you are 
outputting a text file (it doesn't seem to make sense to do it alongside 
html reports which generate html annotations).

Also I fixed a bug in generating text coverage reports which weren't 
working. If you specify a directory for the text report the annotation 
is put in there.

All the best,



READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.

More information about the testing-in-python mailing list