Skip to content

Commit 74683fc

Browse files
authored
bpo-30258: regrtest: Fix run_tests_multiprocess() (python#1479)
If the child process exited with a non-zero code, don't strip the last line of stdout anymore. Add also a sanity check in accumulate_result().
1 parent 9da408d commit 74683fc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Lib/test/libregrtest/main.py

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ def accumulate_result(self, test, result):
116116
elif ok == RESOURCE_DENIED:
117117
self.skipped.append(test)
118118
self.resource_denieds.append(test)
119+
elif ok != INTERRUPTED:
120+
raise ValueError("invalid test result: %r" % ok)
119121

120122
def display_progress(self, test_index, test):
121123
if self.ns.quiet:

Lib/test/libregrtest/runtest_mp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ def _runtest(self):
124124
finally:
125125
self.current_test = None
126126

127-
stdout, _, result = stdout.strip().rpartition("\n")
128127
if retcode != 0:
129128
result = (CHILD_ERROR, "Exit code %s" % retcode)
130129
self.output.put((test, stdout.rstrip(), stderr.rstrip(),
131130
result))
132131
return False
133132

133+
stdout, _, result = stdout.strip().rpartition("\n")
134134
if not result:
135135
self.output.put((None, None, None, None))
136136
return True

0 commit comments

Comments
 (0)