diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index fda20f1f408f90..8e004e21a4fd5a 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()