--- a/tests/run-tests.py Fri Dec 09 00:10:00 2011 +0100
+++ b/tests/run-tests.py Thu Jan 19 01:50:48 2012 +0100
@@ -141,6 +141,8 @@
" rather than capturing and diff'ing it (disables timeout)")
parser.add_option("-f", "--first", action="store_true",
help="exit on the first test failure")
+ parser.add_option("-H", "--htmlcov", action="store_true",
+ help="create an HTML report of the coverage of the files")
parser.add_option("--inotify", action="store_true",
help="enable inotify extension when running tests")
parser.add_option("-i", "--interactive", action="store_true",
@@ -211,7 +213,7 @@
% hgbin)
options.with_hg = hgbin
- options.anycoverage = options.cover or options.annotate
+ options.anycoverage = options.cover or options.annotate or options.htmlcov
if options.anycoverage:
try:
import coverage
@@ -493,8 +495,11 @@
return
covrun('-c')
- omit = ','.join([BINDIR, TESTDIR])
+ omit = ','.join(os.path.join(x, '*') for x in [BINDIR, TESTDIR])
covrun('-i', '-r', '"--omit=%s"' % omit) # report
+ if options.htmlcov:
+ htmldir = os.path.join(TESTDIR, 'htmlcov')
+ covrun('-i', '-b', '"--directory=%s"' % htmldir, '"--omit=%s"' % omit)
if options.annotate:
adir = os.path.join(TESTDIR, 'annotated')
if not os.path.isdir(adir):