Index: Lib/test/regrtest.py =================================================================== --- Lib/test/regrtest.py (révision 80581) +++ Lib/test/regrtest.py (copie de travail) @@ -514,6 +514,8 @@ else: tests = iter(selected) + tests = list(tests) + ntests = len(tests) if use_mp: from threading import Thread from queue import Queue @@ -521,20 +523,20 @@ debug_output_pat = re.compile(r"\[\d+ refs\]$") output = Queue() def tests_and_args(): - for test in tests: + for test_index, test in enumerate(tests): args_tuple = ( (test, verbose, quiet, testdir), dict(huntrleaks=huntrleaks, use_resources=use_resources, debug=debug) ) - yield (test, args_tuple) + yield (test, test_index, args_tuple) pending = tests_and_args() def work(): # A worker thread. try: while True: try: - test, args_tuple = next(pending) + test, test_index, args_tuple = next(pending) except StopIteration: output.put((None, None, None, None)) return @@ -552,8 +554,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)) @@ -562,12 +562,15 @@ for worker in workers: worker.start() finished = 0 + test_index = 1 try: while finished < use_mp: test, stdout, stderr, result = output.get() if test is None: finished += 1 continue + if not quiet: + print("{} ({}/{})".format(test, test_index, ntests)) if stdout: print(stdout) if stderr: @@ -576,15 +579,16 @@ assert result[1] == 'KeyboardInterrupt' raise KeyboardInterrupt # What else? accumulate_result(test, result) + 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): if not quiet: - print(test) + print("{} ({}/{})".format(test, 1+test_index, ntests)) sys.stdout.flush() if trace: # If we're tracing code coverage, then we don't exit with status