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

Chris Withers chris at simplistix.co.uk
Thu Jan 26 02:22:04 PST 2012


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%
testfixtures/components                       20      0      6      1 
  96%
testfixtures/logcapture                       69      0     22      1 
  99%
testfixtures/manuel                           56      0     22      1 
  99%
testfixtures/outputcapture                    24      0      2      0 
100%
testfixtures/replace                          49      0     26      2 
  97%
testfixtures/resolve                          33      0      2      0 
100%
testfixtures/shouldraise                      50      0      6      0 
100%
testfixtures/tdatetime                       122      0     52      1 
  99%
testfixtures/tempdirectory                   118      0     56      3 
  98%
testfixtures/tests/__init__                    2      0      0      0 
100%
testfixtures/tests/compat                     41      0      4      0 
100%
testfixtures/tests/sample1                    30      0      0      0 
100%
testfixtures/tests/sample2                     9      0      2      0 
100%
testfixtures/tests/test_compare              173      0      0      0 
100%
testfixtures/tests/test_comparison           238      0      4      0 
100%
testfixtures/tests/test_components            17      0      0      0 
100%
testfixtures/tests/test_date                 164      0      4      0 
100%
testfixtures/tests/test_datetime             240      0      4      0 
100%
testfixtures/tests/test_diff                  12      0      0      0 
100%
testfixtures/tests/test_docs                  11      0      0      0 
100%
testfixtures/tests/test_generator             13      0      0      0 
100%
testfixtures/tests/test_log_capture           60      0      0      0 
100%
testfixtures/tests/test_logcapture            48      0     22     11 
  84%
testfixtures/tests/test_manuel                93      0      6      0 
100%
testfixtures/tests/test_manuel_examples       19      0      0      0 
100%
testfixtures/tests/test_outputcapture         50      0      0      0 
100%
testfixtures/tests/test_replace              206      0      2      0 
100%
testfixtures/tests/test_replacer              17      0     20     10 
  73%
testfixtures/tests/test_should_raise         169      0      2      1 
  99%
testfixtures/tests/test_stringcomparison      29      0      0      0 
100%
testfixtures/tests/test_tempdir               57      0      0      0 
100%
testfixtures/tests/test_tempdirectory        123      0     18      9 
  94%
testfixtures/tests/test_time                 109      0      0      0 
100%
testfixtures/tests/test_wrap                 109      0      0      0 
100%
testfixtures/utils                            35      0     12      0 
100%
--------------------------------------------------------------------------------------
TOTAL                                       2876      0    418     40 
  99%
----------------------------------------------------------------------
Ran 367 tests in 2.399s

OK

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
             - http://www.simplistix.co.uk



More information about the testing-in-python mailing list