[TIP] coverage.py: how to report unimported files
ned at nedbatchelder.com
Fri Aug 27 08:43:49 PDT 2010
I'm planning on adding support for this functionality. The only
question is how should coverage.py know what set of file could have been
In 3.4 (currently in beta), there's a new --source option: it takes a
list of directories or modules, and directs coverage to only measure
that code. If that option is provided, then it can also mean that all
of the code in those directories and modules should have been imported.
But without that option, I don't know what tree of files coverage.py
should assume should have been imported.
Any ideas? Is --source sufficient? Should it imply that all of the
files in those trees should have been imported, or should there be
another switch to turn that on (--complete?). Is there a heuristic that
would work for finding "should have been imported" code without a
On 8/27/2010 12:15 AM, Ryan Campbell wrote:
> Hi All,
> I've just started using coverage.py on my project, and there is one
> issue I've been struggling with.
> We've just started adding unit tests to our project and the vast
> majority of the modules are still not tested. I would like to have the
> coverage report display what modules in my project have 0% coverage, but
> currently it only seems report the modules that are imported by the unit
> test. Nose seems to have this functionality in it's coverage plugin
> (--cover-inclusive sounds like what I am looking for), but since we
> don't use nose, it doesn't help much.
> One of the main reasons for this request is that the current behaviour
> really skews our metrics. Currently coverage reports that we have 54%
> code coverage, but since this doesn't include any of the completely
> untested files in our project, the real percentage is probably closer to
> 8-10 percent.
> Any suggestions?
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
More information about the testing-in-python