[TIP] Coverage 3.4: modules in "source" but file patterns in "omit"?
Geoff Bache
geoff.bache at gmail.com
Mon Nov 15 03:29:07 PST 2010
Hi all,
Just upgraded to coverage 3.4 - very pleased it's possible to specify
where my source is now...
I am however a bit confused as to why the "source" and "omit" settings
refer to modules in different ways.
I have the following situation: I have program 'myprog' and module
'mymodule' to test. 'myprog' depends on 'mymodule'. Both have their
own test suite, but in the case of 'mymodule', some parts are covered
only by the 'myprog' tests. So I would like 3 reports out: coverage of
myprog, coverage of mymodule, and coverage of mymodule including
myprog's tests. Without needing to run myprog's tests more than once.
myprog is run from its source tree, whereas mymodule is installed.
My coveragerc file for myprog therefore looks like this
[run]
source = /source/directory/containing/myprog,mymodule
[report]
omit = /long/path/python2.6/lib/python2.6/site-packages/mymodule/*,/long/path/python2.6/lib/python2.6/site-packages/mymodule/*/*,/long/path/python2.6/lib/python2.6/site-packages/mymodule/*/*/*
which seems a rather convoluted and brittle way of excluding mymodule
in this report, especially when the setting above handles it more
concisely. Why don't these two settings don't allow referring to the
same entities in the same way?
Regards,
Geoff Bache
More information about the testing-in-python
mailing list