tests: add htmlcov option stable
authorMarkus Zapke-Gr?ndemann <info@keimlink.de>
Wed, 11 Jan 2012 15:38:31 +0100
branchstable
changeset 1039 7c2190b236cf
parent 1038 62b7a0759ee3
child 1040 15aa105f81e2
child 1041 40554705117d
tests: add htmlcov option [ original upstream message ]
tests/run-tests.py
--- 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):