[Python-checkins] devinabox: Script to easily execute coverage.py (requires __main__.py in coveragepy).

brett.cannon python-checkins at python.org
Mon Feb 28 23:03:51 CET 2011


brett.cannon pushed 5c66d683172c to devinabox:

http://hg.python.org/devinabox/rev/5c66d683172c
changeset:   19:5c66d683172c
user:        Brett Cannon <brett at python.org>
date:        Sat Feb 26 14:37:11 2011 -0800
summary:
  Script to easily execute coverage.py (requires __main__.py in coveragepy).

files:
  run_coverage.py

diff --git a/run_coverage.py b/run_coverage.py
new file mode 100755
--- /dev/null
+++ b/run_coverage.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+"""Create a coverage report for CPython"""
+import subprocess
+import os
+import sys
+import build_cpython
+import run_tests
+
+build_cpython.main()
+print(os.getcwd())
+executable = run_tests.executable()
+if not executable:
+    print('no CPython executable found')
+    sys.exit(1)
+
+print('Running coverage ...')
+subprocess.check_call([executable, 'coveragepy', 'run', '--pylib',
+                       os.path.join('cpython', 'Lib', 'test', 'regrtest.py'),
+                      ])
+print('Generating report ...')
+subprocess.call([executable, 'coveragepy', 'html', '-i', '--omit',
+                 '"*/test/*,*/tests/*"', '-d', 'coverage_report'])
+print('Creating symlink ...')
+os.symlink(os.path.join('coverage_report', 'index.html'), 'coverage.html')

--
Repository URL: http://hg.python.org/devinabox


More information about the Python-checkins mailing list