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

Method test_async_timeout

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

Source from the content-addressed store, hash-verified

2749 self.assertTimingAlmostEqual(get.elapsed, TIMEOUT1)
2750
2751 def test_async_timeout(self):
2752 p = self.Pool(3)
2753 try:
2754 event = threading.Event() if self.TYPE == 'threads' else None
2755 res = p.apply_async(sqr, (6, TIMEOUT2 + support.SHORT_TIMEOUT, event))
2756 get = TimingWrapper(res.get)
2757 self.assertRaises(multiprocessing.TimeoutError, get, timeout=TIMEOUT2)
2758 self.assertTimingAlmostEqual(get.elapsed, TIMEOUT2)
2759 finally:
2760 if event is not None:
2761 event.set()
2762 p.terminate()
2763 p.join()
2764
2765 def test_imap(self):
2766 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