I'm trying to generate a Cobertura XML file for Jenkins which only
contains coverage for my package. So now I generate the XML file, I
can't figure out how to have the
$ pip install -e
hg+https://bitbucket.org/aconrad/coverage.py#egg=coverage # contains
aconrad's patch for jinja2 files
$ python setup.py nosetests --with-xunit # reads setup.cfg:
with-coverage=mypackage
$ coverage xml --ignore-errors
The problem is that the last command generates an XML file containing
all python modules system wide (which pollutes my Jenkins report) even
though setup.cfg says it should only cover mypackage.
How can I tell coverage to do that?
Thanks,
--
Alex | twitter.com/alexconrad
nosetests --with-cov --cov=mypackage --cov-report=xml tests/
Using coverage direct as you listed above you could do
coverage xml --include "*mypackage*"
The xml command attends to the --omit and --include switches just like
the other reports do. You should be able to control it that way.
Even better: create a .coveragerc file, and in it put
"source=mypackage", and then you'll also get the benefit of coverage not
bothering to collect data that it won't eventually report on.
--Ned.