[Python-checkins] bpo-31510: Fix multiprocessing test_many_processes() on macOS (#3857)

Victor Stinner webhook-mailer at python.org
Mon Oct 2 11:27:38 EDT 2017


https://github.com/python/cpython/commit/e6cfdefa0c2f5bda177e49b228c2c7528f7c239c
commit: e6cfdefa0c2f5bda177e49b228c2c7528f7c239c
branch: master
author: Victor Stinner <victor.stinner at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-10-02T08:27:34-07:00
summary:

bpo-31510: Fix multiprocessing test_many_processes() on macOS (#3857)

On macOS, a process can exit with -SIGKILL if it is killed "early"
with SIGTERM.

files:
M Lib/test/_test_multiprocessing.py

diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index fda20f1f408..8e004e21a4f 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -501,8 +501,13 @@ def test_many_processes(self):
         for p in procs:
             join_process(p)
         if os.name != 'nt':
+            exitcodes = [-signal.SIGTERM]
+            if sys.platform == 'darwin':
+                # bpo-31510: On macOS, killing a freshly started process with
+                # SIGTERM sometimes kills the process with SIGKILL.
+                exitcodes.append(-signal.SIGKILL)
             for p in procs:
-                self.assertEqual(p.exitcode, -signal.SIGTERM)
+                self.assertIn(p.exitcode, exitcodes)
 
     def test_lose_target_ref(self):
         c = DummyCallable()



More information about the Python-checkins mailing list