I'm using nose and coverage to generate coverage reports. I only have one package right now, ae, so I specify to only cover that:
nosetests -w tests/unit --with-xunit --with-coverage --cover-package=ae
And here are the results, which look good:
Name Stmts Exec Cover Missing
----------------------------------------------
ae 1 1 100%
ae.util 253 224 88% 39, 63-65, 284, 287, 362, 406
----------------------------------------------
TOTAL 263 234 88%
----------------------------------------------------------------------
Ran 68 tests in 5.292s
However when I run coverage xml
, coverage pulls in more packages than necessary, including python email and logging packages which have nothing to do with my code.
If I run coverage xml ae
, I get this error:
No source for code: '/home/wraith/dev/projects/trimurti/src/ae':
[Errno 21] Is a directory: '/home/wraith/dev/projects/trimurti/src/ae'
Is there a way to generate the XML for just the ae package?
I had a similar problem and solved it with the
--omit
option. This made it run much faster and reduced the size of coverage.xml from 2MB to 70kB.I'm on Mac OS X, so I omitted the /Library/ and /Applications/ folders:
On other systems, you may find
--omit=/usr/
more helpful.Did you try:
I wasn't able to find the answer to this, so I'm stripping the unwanted package elements out after processing. This function takes the original XML file, the element name to check, its attribute to check, the pattern (or list of words) you'd like to KEEP, and a destination filepath for the new file.
To solve my problem, I'm calling it like this: