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?
Code coverage is a metric for how much of your codebase gets executed when you run your tests. Basically, it tells you how much of your code is covered by tests and, more important, helps you locate lines in your code that aren't covered.
Basic Usage nose can be integrated with DocTest by using with-doctest option in athe bove command line. The result will be true if the test run is successful, or false if it fails or raises an uncaught exception. nose supports fixtures (setup and teardown methods) at the package, module, class, and test level.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With