]> granicus.if.org Git - python/commitdiff
bpo-30258: regrtest: Fix run_tests_multiprocess() (#1479)
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 9 May 2017 09:34:01 +0000 (11:34 +0200)
committerGitHub <noreply@github.com>
Tue, 9 May 2017 09:34:01 +0000 (11:34 +0200)
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().

Lib/test/libregrtest/main.py
Lib/test/libregrtest/runtest_mp.py

index 2cfbdd12b2a58d29c587728e169c7d3889efaf92..e068b925d57af004860ea6ed9c08a6a865032e60 100644 (file)
@@ -116,6 +116,8 @@ class Regrtest:
         elif ok == RESOURCE_DENIED:
             self.skipped.append(test)
             self.resource_denieds.append(test)
+        elif ok != INTERRUPTED:
+            raise ValueError("invalid test result: %r" % ok)
 
     def display_progress(self, test_index, test):
         if self.ns.quiet:
index 34b3ae6a976c5c302ada76e710515ef22849c4b6..779ff01a649c6cc5192c9fbdc2c5483709735267 100644 (file)
@@ -124,13 +124,13 @@ class MultiprocessThread(threading.Thread):
         finally:
             self.current_test = None
 
-        stdout, _, result = stdout.strip().rpartition("\n")
         if retcode != 0:
             result = (CHILD_ERROR, "Exit code %s" % retcode)
             self.output.put((test, stdout.rstrip(), stderr.rstrip(),
                              result))
             return False
 
+        stdout, _, result = stdout.strip().rpartition("\n")
         if not result:
             self.output.put((None, None, None, None))
             return True