Question

I'm using nosetests to run a few unit tests and show me our code coverage using something like:

nosetests -w ./test --with-xunit --with-coverage --cover-tests

This works well except for the fact that I'm seeing a bunch of Python packages in the output. Here's a sample:

ctypes._endian                 34     12    35%   15-20, 24-32, 50-60
ctypes.macholib                 1      1   100%   
email                          29     25    86%   56-57, 65-66
email.errors                   15     14    93%   39

How do I exclude these packages?

Was it helpful?

Solution

Try the nosetests --cover-package=<name> option. It will restrict coverage output to the listed packages/modules. You can use it more than once if your tests cover multiple packages.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top