changeset 15859:44a371823f83

tests: add htmlcov option
author Markus Zapke-Gründemann <info@keimlink.de>
date Wed, 11 Jan 2012 15:38:31 +0100
parents 14132a55d66b
children 3ecce805ac13
files .hgignore tests/run-tests.py
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Thu Jan 12 14:39:02 2012 -0600
+++ b/.hgignore	Wed Jan 11 15:38:31 2012 +0100
@@ -19,6 +19,7 @@
 tests/.coverage*
 tests/annotated
 tests/*.err
+tests/htmlcov
 build
 contrib/hgsh/hgsh
 dist
--- a/tests/run-tests.py	Thu Jan 12 14:39:02 2012 -0600
+++ b/tests/run-tests.py	Wed Jan 11 15:38:31 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
@@ -495,6 +497,9 @@
     covrun('-c')
     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):