xml report for my package only?

19 views
Skip to first unread message

Alexandre Conrad

unread,
Sep 2, 2011, 7:58:47 PM9/2/11
to coverag...@googlegroups.com
Hi,

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

meme dough

unread,
Sep 4, 2011, 3:02:27 AM9/4/11
to coverag...@googlegroups.com
You could use nose-cov and do

nosetests --with-cov --cov=mypackage --cov-report=xml tests/

Using coverage direct as you listed above you could do

coverage xml --include "*mypackage*"

Ned Batchelder

unread,
Sep 5, 2011, 10:54:58 PM9/5/11
to coverag...@googlegroups.com, Alexandre Conrad
I honestly don't understand how the nose plugin works, and wish people
would stop using it. Memedough's plugin is the result of us
contemplating owning the nose plugin, and then all the other test
runners saying, "Oooh, me too!", and then me giving up because it just
got overwhelming.

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.

Reply all
Reply to author
Forward
0 new messages