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

Method test_async_timeout

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

Source from the content-addressed store, hash-verified

3008
3009 @warnings_helper.ignore_fork_in_thread_deprecation_warnings()
3010 def test_async_timeout(self):
3011 p = self.Pool(3)
3012 try:
3013 event = threading.Event() if self.TYPE == 'threads' else None
3014 res = p.apply_async(sqr, (6, TIMEOUT2 + support.SHORT_TIMEOUT, event))
3015 get = TimingWrapper(res.get)
3016 self.assertRaises(multiprocessing.TimeoutError, get, timeout=TIMEOUT2)
3017 self.assertTimingAlmostEqual(get.elapsed, TIMEOUT2)
3018 finally:
3019 if event is not None:
3020 event.set()
3021 p.terminate()
3022 p.join()
3023
3024 def test_imap(self):
3025 it = self.pool.imap(sqr, list(range(10)))

Callers

nothing calls this directly

Calls 9

apply_asyncMethod · 0.95
terminateMethod · 0.95
joinMethod · 0.95
TimingWrapperClass · 0.85
EventMethod · 0.80
PoolMethod · 0.45
assertRaisesMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected