(self)
| 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): |
nothing calls this directly
no test coverage detected