[Python-checkins] cpython (2.7): regrtest: backport "[ 1/399]" progress back from Python 3
victor.stinner
python-checkins at python.org
Fri Sep 5 12:16:34 CEST 2014
http://hg.python.org/cpython/rev/425c8bbc2ee7
changeset: 92349:425c8bbc2ee7
branch: 2.7
parent: 92346:dd1e21f17b1c
user: Victor Stinner <victor.stinner at gmail.com>
date: Fri Sep 05 12:12:11 2014 +0200
summary:
regrtest: backport "[ 1/399]" progress back from Python 3
The progress bar helps a lot to analyze noisy buildbot logs, to find quickly
where errors occurred.
files:
Lib/test/regrtest.py | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -475,8 +475,12 @@
if bad:
return
tests = test_forever()
+ test_count = ''
+ test_count_width = 3
else:
tests = iter(selected)
+ test_count = '/{}'.format(len(selected))
+ test_count_width = len(test_count) - 1
if use_mp:
try:
@@ -521,8 +525,6 @@
output.put((None, None, None, None))
return
result = json.loads(result)
- if not quiet:
- stdout = test+'\n'+stdout
output.put((test, stdout.rstrip(), stderr.rstrip(), result))
except BaseException:
output.put((None, None, None, None))
@@ -531,6 +533,7 @@
for worker in workers:
worker.start()
finished = 0
+ test_index = 1
try:
while finished < use_mp:
test, stdout, stderr, result = output.get()
@@ -547,15 +550,23 @@
assert result[1] == 'KeyboardInterrupt'
raise KeyboardInterrupt # What else?
accumulate_result(test, result)
+ if not quiet:
+ fmt = "[{1:{0}}{2}/{3}] {4}" if bad else "[{1:{0}}{2}] {4}"
+ print(fmt.format(
+ test_count_width, test_index, test_count,
+ len(bad), test))
+ test_index += 1
except KeyboardInterrupt:
interrupted = True
pending.close()
for worker in workers:
worker.join()
else:
- for test in tests:
+ for test_index, test in enumerate(tests, 1):
if not quiet:
- print test
+ fmt = "[{1:{0}}{2}/{3}] {4}" if bad else "[{1:{0}}{2}] {4}"
+ print(fmt.format(
+ test_count_width, test_index, test_count, len(bad), test))
sys.stdout.flush()
if trace:
# If we're tracing code coverage, then we don't exit with status
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list