[TIP] [coverage] anyway to omit modules rather than files?

Ned Batchelder ned at nedbatchelder.com
Thu Jan 26 05:01:02 PST 2012


On 1/26/2012 5:22 AM, Chris Withers wrote:
> On 25/01/2012 21:11, Ned Batchelder wrote:
>> True, it will include testfixtures.tests. I always prefer to cover the
>> tests also: occasionally something useful is discovered, like two tests
>> with the same name, so one doesn't run. But I understand not everyone
>> wants that.
>
> You're right, I was being lazy. Fixed now...
>
> ...which raises another question:
>
> I tried turning branch=True on, and I don't get 100%, but how do I 
> figure out what's not being covered, this doesn't help:
>
> $ bin/nosetests --with-cov --cov-report=term-missing
> ............................................................................................................................................................................................................................................................................................................................................................................... 
>
> ---------- coverage: platform darwin, python 2.7.2-final-0 -----------
> Name                                       Stmts   Miss Branch BrPart 
> Cover   Missing
> -------------------------------------------------------------------------------------- 
>
> testfixtures/__init__                         17      0      0      0 
> 100%
> testfixtures/comparison                      244      0    124      0 
> 100%
<snip>

Have you looked at the html report?  It indicates missing lines in red 
and partial branches in yellow.

--Ned.

> cheers,
>
> Chris
>



More information about the testing-in-python mailing list