MCPcopy Index your code
hub / github.com/python/cpython / test_set_get

Method test_set_get

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

Source from the content-addressed store, hash-verified

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()

Callers

nothing calls this directly

Calls 9

check_contextMethod · 0.95
assertStartsWithMethod · 0.80
assertGreaterEqualMethod · 0.80
get_start_methodMethod · 0.45
set_start_methodMethod · 0.45
assertEqualMethod · 0.45
get_contextMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected