diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2012-05-06 15:46:36 (GMT) |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2012-05-06 15:46:36 (GMT) |
commit | 6dbca367dceda3999979bdc3cdcfdb201f40d044 (patch) | |
tree | c85c18bd5710e1e6120ba140cf78ad0b51022015 /Lib/test/test_multiprocessing.py | |
parent | 41eb85b194909d68bb05b81442f10026b9279560 (diff) | |
download | cpython-6dbca367dceda3999979bdc3cdcfdb201f40d044.zip cpython-6dbca367dceda3999979bdc3cdcfdb201f40d044.tar.gz cpython-6dbca367dceda3999979bdc3cdcfdb201f40d044.tar.bz2 |
Make test_multiprocessing more lenient about another timeout check
Diffstat (limited to 'Lib/test/test_multiprocessing.py')
-rw-r--r-- | Lib/test/test_multiprocessing.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py index 5e471f1..4496f39 100644 --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -922,7 +922,8 @@ class _TestCondition(BaseTestCase): self.assertEqual(p.exitcode, 0) @classmethod - def _test_waitfor_timeout_f(cls, cond, state, success): + def _test_waitfor_timeout_f(cls, cond, state, success, sem): + sem.release() with cond: expected = 0.1 dt = time.time() @@ -938,11 +939,13 @@ class _TestCondition(BaseTestCase): cond = self.Condition() state = self.Value('i', 0) success = self.Value('i', False) + sem = self.Semaphore(0) p = self.Process(target=self._test_waitfor_timeout_f, - args=(cond, state, success)) + args=(cond, state, success, sem)) p.daemon = True p.start() + self.assertTrue(sem.acquire(timeout=10)) # Only increment 3 times, so state == 4 is never reached. for i in range(3): @@ -2723,8 +2726,8 @@ class TestWait(unittest.TestCase): delta = time.time() - start self.assertEqual(res, []) - self.assertLess(delta, expected + 1) - self.assertGreater(delta, expected - 1) + self.assertLess(delta, expected * 2) + self.assertGreater(delta, expected * 0.5) b.send(None) |