Skip to content

Commit 24947a8

Browse files
authored
When printing test harness stuff, print to stderr to be more consistent. (#25081)
Iirc the original rationale for the test harness was that test harness infra related prints would go to stderr, and tests itself would print to stdout? (at least that is how I gathered it to be from the start of time..) Most of the harness stuff goes to stderr, though a few stray lines do not. So move those to print to stderr also to be more consistent. When observing the prints on Buildbot, this distinction helps a bit visually, since stderr is printed red, and individual test output then in gray.
1 parent 38b34de commit 24947a8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test/parallel_testsuite.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def run(self, result):
8181
# reverse alphabetical order.
8282
tests = list(self if self.failing_and_slow_first else self.reversed_tests())
8383
use_cores = cap_max_workers_in_pool(min(self.max_cores, len(tests), num_cores()))
84-
print('Using %s parallel test processes' % use_cores)
84+
print('Using %s parallel test processes' % use_cores, file=sys.stderr)
8585
with multiprocessing.Manager() as manager:
8686
pool = multiprocessing.Pool(use_cores)
8787
failfast_event = manager.Event() if self.failfast else None
@@ -128,9 +128,9 @@ def reversed_tests(self):
128128
return sorted(self, key=str, reverse=True)
129129

130130
def combine_results(self, result, buffered_results):
131-
print()
132-
print('DONE: combining results on main thread')
133-
print()
131+
print('', file=sys.stderr)
132+
print('DONE: combining results on main thread', file=sys.stderr)
133+
print('', file=sys.stderr)
134134
# Sort the results back into alphabetical order. Running the tests in
135135
# parallel causes mis-orderings, this makes the results more readable.
136136
results = sorted(buffered_results, key=lambda res: str(res.test))

test/runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def run_tests(options, suites):
431431
total_core_time = 0
432432
run_start_time = time.perf_counter()
433433
for mod_name, suite in suites:
434-
print('Running %s: (%s tests)' % (mod_name, suite.countTestCases()))
434+
print('Running %s: (%s tests)' % (mod_name, suite.countTestCases()), file=sys.stderr)
435435
res = testRunner.run(suite)
436436
msg = ('%s: %s run, %s errors, %s failures, %s skipped' %
437437
(mod_name, res.testsRun, len(res.errors), len(res.failures), len(res.skipped)))
@@ -441,7 +441,7 @@ def run_tests(options, suites):
441441
total_core_time += res.core_time
442442
total_run_time = time.perf_counter() - run_start_time
443443
if total_core_time > 0:
444-
print('Total core time: %.3fs. Wallclock time: %.3fs. Parallelization: %.2fx.' % (total_core_time, total_run_time, total_core_time / total_run_time))
444+
print('Total core time: %.3fs. Wallclock time: %.3fs. Parallelization: %.2fx.' % (total_core_time, total_run_time, total_core_time / total_run_time), file=sys.stderr)
445445

446446
if len(resultMessages) > 1:
447447
print('====================')

0 commit comments

Comments
 (0)