(self)
| 2035 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 2036 | @unittest.skipUnless(HAS_SHAREDCTYPES, 'needs sharedctypes') |
| 2037 | def test_waitfor_timeout(self): |
| 2038 | # based on test in test/lock_tests.py |
| 2039 | cond = self.Condition() |
| 2040 | state = self.Value('i', 0) |
| 2041 | success = self.Value('i', False) |
| 2042 | sem = self.Semaphore(0) |
| 2043 | |
| 2044 | p = self.Process(target=self._test_waitfor_timeout_f, |
| 2045 | args=(cond, state, success, sem)) |
| 2046 | p.daemon = True |
| 2047 | p.start() |
| 2048 | self.assertTrue(sem.acquire(timeout=support.LONG_TIMEOUT)) |
| 2049 | |
| 2050 | # Only increment 3 times, so state == 4 is never reached. |
| 2051 | for i in range(3): |
| 2052 | time.sleep(0.010) |
| 2053 | with cond: |
| 2054 | state.value += 1 |
| 2055 | cond.notify() |
| 2056 | |
| 2057 | join_process(p) |
| 2058 | self.assertTrue(success.value) |
| 2059 | |
| 2060 | @classmethod |
| 2061 | def _test_wait_result(cls, c, pid): |
nothing calls this directly
no test coverage detected