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

Method test_terminate

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

Source from the content-addressed store, hash-verified

2861 p.join()
2862
2863 def test_terminate(self):
2864 # Simulate slow tasks which take "forever" to complete
2865 sleep_time = support.LONG_TIMEOUT
2866
2867 if self.TYPE == 'threads':
2868 # Thread pool workers can't be forced to quit, so if the first
2869 # task starts early enough, we will end up waiting for it.
2870 # Sleep for a shorter time, so the test doesn't block.
2871 sleep_time = 1
2872
2873 p = self.Pool(3)
2874 args = [sleep_time for i in range(10_000)]
2875 result = p.map_async(time.sleep, args, chunksize=1)
2876 time.sleep(0.2) # give some tasks a chance to start
2877 p.terminate()
2878 p.join()
2879
2880 def test_empty_iterable(self):
2881 # See Issue 12157

Callers

nothing calls this directly

Calls 5

map_asyncMethod · 0.95
terminateMethod · 0.95
joinMethod · 0.95
PoolMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected