find completely uncovered files

5 views
Skip to first unread message

zooko

unread,
Aug 31, 2010, 4:56:42 PM8/31/10
to Coverage.py Development
Hi Ned:

I happened to see this today:

https://bitbucket.org/ned/coveragepy/changeset/ea7c007cec33

"Some prep work for finding completely uncovered files."

I have a similar feature in trialcoverage:

http://tahoe-lafs.org/trac/trialcoverage/browser/trunk/trialcoverage/trialcoverage.py?rev=42#L54

and here are some tests of it:

http://tahoe-lafs.org/trac/trialcoverage/browser/trunk/trialcoverage/test/test_import_all.py?rev=43

The way it works is that it imports all Python files while the
coverage tracer is turned on. This not only adds each of those files
to the result set but it also means that all of the import-time lines
in the file will be marked as covered. This was important to us
because before I added this feature different runs of the code would
get import-time lines marked as covered or as uncovered depending on
whether they had been imported earlier in the Python process (before
the test code itself ran). This hack made it so that the code coverage
results were consistent -- always showing the import-time lines as
covered, as well as more informative (since the import-time lines
*were* covered), as well as preventing completely-uncovered files from
being omitted from the report.


I'm currently trying to integrate it better with distutils/setuptools/
distribute/distutils2 so that it learns what are the packages, package
dirs, and modules from the packaging and just imports Python files
which are plausibly a part of that set.

Regards,

Zooko

Ned Batchelder

unread,
Aug 31, 2010, 5:08:28 PM8/31/10
to coverag...@googlegroups.com, zooko
I think it's fine for a test runner to import extra files to get them
added to the coverage measurement, but I'm not comfortable doing that in
the vanilla coverage.py. My plan is to look for files within the
--source trees that are not present in the coverage data, and report
them as 0% covered. This would happen not during the execution phase,
but during the reporting phase.

--Ned.

Reply all
Reply to author
Forward
0 new messages