When would my Python test suite file coverage not be 100%?

577 Views Asked by At

We are using Hudson and coverage.py to report the code coverage of our test suite. Hudson breaks down coverage into:

  • packages
  • files
  • classes
  • lines
  • conditionals

Coverage.py only reports coverage on files executed/imported during the tests, and so it seems is oblivious to any files not executed during the tests. Is there ever an instance where files would not report 100% coverage?

2

There are 2 best solutions below

2
On BEST ANSWER

Currently, coverage.py doesn't know how to find files that are never executed and report them as not covered, but that will be coming in the next release. So now, the file coverage will always be 100%. This is an area where Hudson (using the Cobertura plugin) and coverage.py don't mesh very well.

0
On

Coverage.py now (as of 3.4) does let you find completely unexecuted files. See the docs for details.