3

I am in the process of trying to integrate code coverage into our development pipeline, and we are having a hard time using nosetest to accurately estimate our code coverage due to the fact that it also checks coverage for each of our imported libraries in our python packages. So we end up with code coverage percentages for things like import os, which is not allowing us to really see the data we want.

I have looked into using coverage.py, but that's in the very early stages.

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

Thanks in advance!

jlack
  • 305
  • 2
  • 13
AndrewD
  • 75
  • 7
  • 1
    While code coverage is of course not a silver bullet, I think "the biggest placebo you can ask for" is overboard. Yes, it's true it doesn't tell you that all possible situations are accounted for, but in many cases it's a good indicator that you've done a pretty good job testing your code. – jlack Jun 14 '17 at 14:03

1 Answers1

4

Nosetests has an option to only produce coverage for named packages e.g.

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

This is what I've done in the past.

However, I moved over to pytest. I liked this better because it produced better error message, including dictionary diffs.

Martin
  • 7,089
  • 3
  • 28
  • 43