Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove packages from coverage report

I create a coverage report like this:

nosetests --with-coverage --cover-html

My .coveragerc file looks like this:

# .coveragerc to control coverage.py
[run]
branch = True
omit = contextlib, ctypes, ctypes._endian, ctypes.util, filecmp, getpass, sets, subprocess, uuid

[report]
exclude_lines =
    pragma: no cover

But my report looks like this:

..........
Name             Stmts   Miss Branch BrPart  Cover   Missing
------------------------------------------------------------
abefdb              48     14     13      7    66%   16, 32, 42-43, 47, 57-58, 61-68, 74
ablo                29      2      6      3    86%   44, 66
backup             159     47     61     37    62%   43-51, 54-65, 90, 92, 94, 96, 98, 125, 146-147, 151-158, 178-180, 206, 211, 214, 229, 236-239, 243, 248
contextlib          63     63     14     14     0%   3-154
ctypes             341    341    110    110     0%   4-555
ctypes._endian      35     35     14     14     0%   4-64
ctypes.util        169    169     74     74     0%   4-258
filecmp            160    160     64     64     0%   12-296
getpass            103    103     40     40     0%   18-179
gpiomock            14      0      0      0   100%   
sets               266    266     82     82     0%   57-557
subprocess         641    641    345    345     0%   12-1532
utils              180     52     44     26    65%   24-25, 39-40, 51-53, 62, 67-81, 84-86, 90-92, 96-97, 105, 111-112, 115-116, 134, 144, 147-148, 153-154, 180, 183, 190-194, 206, 211, 224, 227, 230, 236, 251
uuid               293    293    124    124     0%   47-560
------------------------------------------------------------
TOTAL             2501   2186    991    940    10%   
----------------------------------------------------------------------
Ran 10 tests in 7.730s

OK

How can I remove the standard library packages with 0% cover from the report? Obviously listing them in omit does not work the way I expect...

like image 602
mnagel Avatar asked Aug 31 '13 08:08

mnagel


1 Answers

omit must be a list of directory/filename patterns, like:

omit = /usr/*, /System/*
like image 101
chlunde Avatar answered Oct 03 '22 04:10

chlunde