summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-08-12 03:45:50 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-08-12 03:45:50 (GMT)
commita45da92484ceececf1cf32b4dfb16004945b001e (patch)
tree201eff034128ea0317d22eb9f830eac0fe59cf8f /Lib/test/regrtest.py
parent8de8680d071df3bddcb5d56a06d11697a32a922e (diff)
downloadcpython-a45da92484ceececf1cf32b4dfb16004945b001e.zip
cpython-a45da92484ceececf1cf32b4dfb16004945b001e.tar.gz
cpython-a45da92484ceececf1cf32b4dfb16004945b001e.tar.bz2
Make the output of tests skipped readable (i.e., deliberately break it
into indented lines each of which probably fits on a typical screen line).
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py36
1 files changed, 30 insertions, 6 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 6078cd1..285acba 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -163,11 +163,11 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
print "CAUTION: stdout isn't compared in verbose mode: a test"
print "that passes in verbose mode may fail without it."
if bad:
- print count(len(bad), "test"), "failed:",
- print " ".join(bad)
+ print count(len(bad), "test"), "failed:"
+ printlist(bad)
if skipped and not quiet:
- print count(len(skipped), "test"), "skipped:",
- print " ".join(skipped)
+ print count(len(skipped), "test"), "skipped:"
+ printlist(skipped)
e = _ExpectedSkips()
plat = sys.platform
@@ -175,8 +175,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
surprise = _Set(skipped) - e.getexpected()
if surprise:
print count(len(surprise), "skip"), \
- "unexpected on", plat + ":", \
- " ".join(surprise.tolist())
+ "unexpected on", plat + ":"
+ printlist(surprise)
else:
print "Those skips are all expected on", plat + "."
else:
@@ -321,6 +321,30 @@ def count(n, word):
else:
return "%d %ss" % (n, word)
+def printlist(x, width=70, indent=4):
+ """Print the elements of a sequence to stdout.
+
+ Optional arg width (default 70) is the maximum line length.
+ Optional arg indent (default 4) is the number of blanks with which to
+ begin each line.
+ """
+
+ line = ' ' * indent
+ for one in map(str, x):
+ w = len(line) + len(one)
+ if line[-1:] == ' ':
+ pad = ''
+ else:
+ pad = ' '
+ w += 1
+ if w > width:
+ print line
+ line = ' ' * indent + one
+ else:
+ line += pad + one
+ if len(line) > indent:
+ print line
+
class Compare:
def __init__(self, filename):