MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_many_processes

Method test_many_processes

Lib/test/_test_multiprocessing.py:704–737  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

702
703 @support.requires_resource('walltime')
704 def test_many_processes(self):
705 if self.TYPE == 'threads':
706 self.skipTest('test not appropriate for {}'.format(self.TYPE))
707
708 sm = multiprocessing.get_start_method()
709 N = 5 if sm == 'spawn' else 100
710
711 # Try to overwhelm the forkserver loop with events
712 procs = [self.Process(target=self._test_sleep, args=(0.01,))
713 for i in range(N)]
714 for p in procs:
715 p.start()
716 for p in procs:
717 join_process(p)
718 for p in procs:
719 self.assertEqual(p.exitcode, 0)
720
721 procs = [self.Process(target=self._sleep_some)
722 for i in range(N)]
723 for p in procs:
724 p.start()
725 time.sleep(0.001) # let the children start...
726 for p in procs:
727 p.terminate()
728 for p in procs:
729 join_process(p)
730 if os.name != 'nt':
731 exitcodes = [-signal.SIGTERM]
732 if sys.platform == 'darwin':
733 # bpo-31510: On macOS, killing a freshly started process with
734 # SIGTERM sometimes kills the process with SIGKILL.
735 exitcodes.append(-signal.SIGKILL)
736 for p in procs:
737 self.assertIn(p.exitcode, exitcodes)
738
739 def test_lose_target_ref(self):
740 c = DummyCallable()

Callers

nothing calls this directly

Calls 11

join_processFunction · 0.85
skipTestMethod · 0.80
assertInMethod · 0.80
formatMethod · 0.45
get_start_methodMethod · 0.45
ProcessMethod · 0.45
startMethod · 0.45
assertEqualMethod · 0.45
sleepMethod · 0.45
terminateMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected