2013-08-31 36 views
5

Böyle bir kapsama rapor oluşturmak:kaldır paketleri

nosetests --with-coverage --cover-html 

Benim .coveragerc dosya şuna benzer:

# .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 

Ama raporu şuna benzer:

.......... 
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 

Standart kitaplık paketlerini raporun% 0'lık kapağından nasıl kaldırabilirim?

omit = /usr/*, /System/* 

cevap

6

omit

gibi, dizin/dosya adı kalıplarının bir liste olmalı ... beklediğim şekilde çalışmıyor omit bunları listeleyen standart kütüphane çalışırken `/ usr` içinde, 'omit =/usr/*` benim için hile yapar.
+1

haklısın ve benim kod ikamet değildir: Açıkçası – mnagel