[PATCH] Add coverage support to run-tests.py (inc. annotation)

Stephen Darnell stephen at darnell.plus.com
Thu Apr 27 22:25:43 UTC 2006


Here's a follow up patch that adds coverage support as promised.

There are command line options to enable coverage (rather than the 
environment variables in the sh run-tests).  I've also used python rather 
than relying on sh for the wrapper hg script.

-C/--annotate enables coverage and annotation - this isn't as fancy as the 
html formatting suggested, but was simple, and can be improved later.
With the default VIM highlighting of search expressions, you can easily see 
the non-covered lines with /^!.*

Currently coverage.py uses the basename so any duplicates in different 
packages will be overriden - so I wouldn't suggest annotating when 
collecting standard library coverage.

NB I also encountered problems on RedHat with Python 2.3 where coverage.py 
would have records for /<string> and barf because such a file didn't exist. 
This patch includes a work-around in coverage.py.

Regards,
  Stephen

PS Thanks Thomas for fixing up my previous patch - I was testing things out 
on windows.  In what way didn't the try/finally always work?
(did it exit normally, but leave stuff in tmp?)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: coverage_patch.txt
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20060427/a2937a30/attachment-0001.txt>


More information about the Mercurial mailing list