Commit a45da924 authored by Tim Peters's avatar Tim Peters

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).
parent 8de8680d
...@@ -163,11 +163,11 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, ...@@ -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 "CAUTION: stdout isn't compared in verbose mode: a test"
print "that passes in verbose mode may fail without it." print "that passes in verbose mode may fail without it."
if bad: if bad:
print count(len(bad), "test"), "failed:", print count(len(bad), "test"), "failed:"
print " ".join(bad) printlist(bad)
if skipped and not quiet: if skipped and not quiet:
print count(len(skipped), "test"), "skipped:", print count(len(skipped), "test"), "skipped:"
print " ".join(skipped) printlist(skipped)
e = _ExpectedSkips() e = _ExpectedSkips()
plat = sys.platform plat = sys.platform
...@@ -175,8 +175,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, ...@@ -175,8 +175,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
surprise = _Set(skipped) - e.getexpected() surprise = _Set(skipped) - e.getexpected()
if surprise: if surprise:
print count(len(surprise), "skip"), \ print count(len(surprise), "skip"), \
"unexpected on", plat + ":", \ "unexpected on", plat + ":"
" ".join(surprise.tolist()) printlist(surprise)
else: else:
print "Those skips are all expected on", plat + "." print "Those skips are all expected on", plat + "."
else: else:
...@@ -321,6 +321,30 @@ def count(n, word): ...@@ -321,6 +321,30 @@ def count(n, word):
else: else:
return "%d %ss" % (n, word) 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: class Compare:
def __init__(self, filename): def __init__(self, filename):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment