(self)
| 6081 | |
| 6082 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 6083 | def test_set_get(self): |
| 6084 | multiprocessing.set_forkserver_preload(PRELOAD) |
| 6085 | count = 0 |
| 6086 | old_method = multiprocessing.get_start_method() |
| 6087 | try: |
| 6088 | for method in ('fork', 'spawn', 'forkserver'): |
| 6089 | try: |
| 6090 | multiprocessing.set_start_method(method, force=True) |
| 6091 | except ValueError: |
| 6092 | continue |
| 6093 | self.assertEqual(multiprocessing.get_start_method(), method) |
| 6094 | ctx = multiprocessing.get_context() |
| 6095 | self.assertEqual(ctx.get_start_method(), method) |
| 6096 | self.assertStartsWith(type(ctx).__name__.lower(), method) |
| 6097 | self.assertStartsWith(ctx.Process.__name__.lower(), method) |
| 6098 | self.check_context(multiprocessing) |
| 6099 | count += 1 |
| 6100 | finally: |
| 6101 | multiprocessing.set_start_method(old_method, force=True) |
| 6102 | self.assertGreaterEqual(count, 1) |
| 6103 | |
| 6104 | def test_get_all_start_methods(self): |
| 6105 | methods = multiprocessing.get_all_start_methods() |
nothing calls this directly
no test coverage detected