(self)
| 5709 | ctx.set_forkserver_preload([1, 2, 3]) |
| 5710 | |
| 5711 | def test_set_get(self): |
| 5712 | multiprocessing.set_forkserver_preload(PRELOAD) |
| 5713 | count = 0 |
| 5714 | old_method = multiprocessing.get_start_method() |
| 5715 | try: |
| 5716 | for method in ('fork', 'spawn', 'forkserver'): |
| 5717 | try: |
| 5718 | multiprocessing.set_start_method(method, force=True) |
| 5719 | except ValueError: |
| 5720 | continue |
| 5721 | self.assertEqual(multiprocessing.get_start_method(), method) |
| 5722 | ctx = multiprocessing.get_context() |
| 5723 | self.assertEqual(ctx.get_start_method(), method) |
| 5724 | self.assertTrue(type(ctx).__name__.lower().startswith(method)) |
| 5725 | self.assertTrue( |
| 5726 | ctx.Process.__name__.lower().startswith(method)) |
| 5727 | self.check_context(multiprocessing) |
| 5728 | count += 1 |
| 5729 | finally: |
| 5730 | multiprocessing.set_start_method(old_method, force=True) |
| 5731 | self.assertGreaterEqual(count, 1) |
| 5732 | |
| 5733 | def test_get_all(self): |
| 5734 | methods = multiprocessing.get_all_start_methods() |
nothing calls this directly
no test coverage detected