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

Method test_waitfor

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

Source from the content-addressed store, hash-verified

1798
1799 @unittest.skipUnless(HAS_SHAREDCTYPES, 'needs sharedctypes')
1800 def test_waitfor(self):
1801 # based on test in test/lock_tests.py
1802 cond = self.Condition()
1803 state = self.Value('i', -1)
1804
1805 p = self.Process(target=self._test_waitfor_f, args=(cond, state))
1806 p.daemon = True
1807 p.start()
1808
1809 with cond:
1810 result = cond.wait_for(lambda : state.value==0)
1811 self.assertTrue(result)
1812 self.assertEqual(state.value, 0)
1813
1814 for i in range(4):
1815 time.sleep(0.01)
1816 with cond:
1817 state.value += 1
1818 cond.notify()
1819
1820 join_process(p)
1821 self.assertEqual(p.exitcode, 0)
1822
1823 @classmethod
1824 def _test_waitfor_timeout_f(cls, cond, state, success, sem):

Callers

nothing calls this directly

Calls 10

wait_forMethod · 0.95
notifyMethod · 0.95
join_processFunction · 0.85
ValueMethod · 0.80
assertTrueMethod · 0.80
ConditionMethod · 0.45
ProcessMethod · 0.45
startMethod · 0.45
assertEqualMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected