(self)
| 1999 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 2000 | @unittest.skipUnless(HAS_SHAREDCTYPES, 'needs sharedctypes') |
| 2001 | def test_waitfor(self): |
| 2002 | # based on test in test/lock_tests.py |
| 2003 | cond = self.Condition() |
| 2004 | state = self.Value('i', -1) |
| 2005 | |
| 2006 | p = self.Process(target=self._test_waitfor_f, args=(cond, state)) |
| 2007 | p.daemon = True |
| 2008 | p.start() |
| 2009 | |
| 2010 | with cond: |
| 2011 | result = cond.wait_for(lambda : state.value==0) |
| 2012 | self.assertTrue(result) |
| 2013 | self.assertEqual(state.value, 0) |
| 2014 | |
| 2015 | for i in range(4): |
| 2016 | time.sleep(0.01) |
| 2017 | with cond: |
| 2018 | state.value += 1 |
| 2019 | cond.notify() |
| 2020 | |
| 2021 | join_process(p) |
| 2022 | self.assertEqual(p.exitcode, 0) |
| 2023 | |
| 2024 | @classmethod |
| 2025 | def _test_waitfor_timeout_f(cls, cond, state, success, sem): |
nothing calls this directly
no test coverage detected