[Python-checkins] distutils2: Very minor edits to runtests* to remove diff noise between them
tarek.ziade
python-checkins at python.org
Sun Aug 8 11:50:44 CEST 2010
tarek.ziade pushed 6dd1d6de357c to distutils2:
http://hg.python.org/distutils2/rev/6dd1d6de357c
changeset: 396:6dd1d6de357c
parent: 394:28671dbbf3d0
user: ?ric Araujo <merwok at netwok.org>
date: Fri Jul 30 07:24:21 2010 +0200
summary: Very minor edits to runtests* to remove diff noise between them
files: src/runtests-cov.py, src/runtests.py
diff --git a/src/runtests-cov.py b/src/runtests-cov.py
--- a/src/runtests-cov.py
+++ b/src/runtests-cov.py
@@ -8,6 +8,7 @@
from os.path import dirname, islink, realpath
from optparse import OptionParser
+
def ignore_prefixes(module):
""" Return a list of prefixes to ignore in the coverage report if
we want to completely skip `module`.
@@ -16,16 +17,17 @@
# distributions, such a Ubuntu, really like to build link farm in
# /usr/lib in order to save a few bytes on the disk.
dirnames = [dirname(module.__file__)]
-
+
pymod = module.__file__.rstrip("c")
if islink(pymod):
dirnames.append(dirname(realpath(pymod)))
return dirnames
+
def parse_opts():
parser = OptionParser(usage="%prog [OPTIONS]",
description="run the distutils2 unittests")
-
+
parser.add_option("-q", "--quiet", help="do not print verbose messages",
action="store_true", default=False)
parser.add_option("-c", "--coverage", action="store_true", default=False,
@@ -36,10 +38,11 @@
default=False,
help=("Show line numbers of statements in each module "
"that weren't executed."))
-
+
opts, args = parser.parse_args()
return opts, args
+
def coverage_report(opts):
import coverage
from distutils2.tests.support import unittest
@@ -89,6 +92,7 @@
return ret
+
def run_tests(verbose):
import distutils2.tests
from distutils2.tests import run_unittest, reap_children, TestFailed
@@ -108,12 +112,11 @@
finally:
reap_children()
+
if __name__ == "__main__":
try:
from distutils2.tests.support import unittest
except ImportError:
sys.stderr.write('Error: You have to install unittest2')
sys.exit(1)
-
sys.exit(test_main())
-
diff --git a/src/runtests.py b/src/runtests.py
--- a/src/runtests.py
+++ b/src/runtests.py
@@ -1,9 +1,12 @@
+#!/usr/bin/env python
"""Tests for distutils2.
The tests for distutils2 are defined in the distutils2.tests package.
"""
+
import sys
+
def test_main():
import distutils2.tests
from distutils2.tests import run_unittest, reap_children, TestFailed
@@ -23,12 +26,11 @@
finally:
reap_children()
+
if __name__ == "__main__":
try:
from distutils2.tests.support import unittest
except ImportError:
sys.stderr.write('Error: You have to install unittest2')
sys.exit(1)
-
sys.exit(test_main())
-
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list