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

Method test_set_get

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 10

check_contextMethod · 0.95
assertTrueMethod · 0.80
assertGreaterEqualMethod · 0.80
get_start_methodMethod · 0.45
set_start_methodMethod · 0.45
assertEqualMethod · 0.45
get_contextMethod · 0.45
startswithMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected