[Python-checkins] devinabox: Refactor run_coverage.py.

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


brett.cannon pushed 3efec08c0767 to devinabox:

http://hg.python.org/devinabox/rev/3efec08c0767
changeset:   23:3efec08c0767
user:        Brett Cannon <brett at python.org>
date:        Sat Feb 26 18:00:35 2011 -0800
summary:
  Refactor run_coverage.py.

files:
  run_coverage.py

diff --git a/run_coverage.py b/run_coverage.py
--- a/run_coverage.py
+++ b/run_coverage.py
@@ -6,19 +6,24 @@
 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')
+def main():
+    build_cpython.main()
+    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')
+
+
+if __name__ == '__main__':
+    main()

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


More information about the Python-checkins mailing list