(self)
| 792 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 793 | @support.requires_resource('walltime') |
| 794 | def test_many_processes(self): |
| 795 | if self.TYPE == 'threads': |
| 796 | self.skipTest('test not appropriate for {}'.format(self.TYPE)) |
| 797 | |
| 798 | sm = multiprocessing.get_start_method() |
| 799 | N = 5 if sm == 'spawn' else 100 |
| 800 | |
| 801 | # Try to overwhelm the forkserver loop with events |
| 802 | procs = [self.Process(target=self._test_sleep, args=(0.01,)) |
| 803 | for i in range(N)] |
| 804 | for p in procs: |
| 805 | p.start() |
| 806 | for p in procs: |
| 807 | join_process(p) |
| 808 | for p in procs: |
| 809 | self.assertEqual(p.exitcode, 0) |
| 810 | |
| 811 | procs = [self.Process(target=self._sleep_some) |
| 812 | for i in range(N)] |
| 813 | for p in procs: |
| 814 | p.start() |
| 815 | time.sleep(0.001) # let the children start... |
| 816 | for p in procs: |
| 817 | p.terminate() |
| 818 | for p in procs: |
| 819 | join_process(p) |
| 820 | if os.name != 'nt': |
| 821 | exitcodes = [-signal.SIGTERM] |
| 822 | if sys.platform == 'darwin': |
| 823 | # bpo-31510: On macOS, killing a freshly started process with |
| 824 | # SIGTERM sometimes kills the process with SIGKILL. |
| 825 | exitcodes.append(-signal.SIGKILL) |
| 826 | for p in procs: |
| 827 | self.assertIn(p.exitcode, exitcodes) |
| 828 | |
| 829 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 830 | def test_lose_target_ref(self): |
nothing calls this directly
no test coverage detected