Best way to measure code coverage for python without checking every imported module

I am trying to integrate code coverage into our development pipeline and it is difficult for us to use nosetest

to accurately estimate code coverage due to the fact that it also checks coverage for each of our imported libraries in our python packages. This way we get the percentage of code coverage for things like import os

that doesn't allow us to actually see the data we need.

I considered using it coverage.py

, but at a very early stage.

I thought to ask if anyone else has this problem and how they overcame it.

Thanks in advance!

+3


source to share


1 answer


Nosetests has the ability to only produce coverage for named packages, for example.

--cover-package=foo --cover-package=bar

      



This is what I have done in the past.

However, I switched to pytest . I liked this better because it generated a better error message including dictionary differences.

+4


source







All Articles