
python-checkins at python
May 6, 2012, 8:56 AM
Post #1 of 1
(32 views)
Permalink
|
|
cpython: Make test multiprocessing more lenient about another timeout check
|
|
http://hg.python.org/cpython/rev/5c60c142f099 changeset: 76801:5c60c142f099 user: Richard Oudkerk <shibturn [at] gmail> date: Sun May 06 16:46:36 2012 +0100 summary: Make test_multiprocessing more lenient about another timeout check files: 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 --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -922,7 +922,8 @@ 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 @@ 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 @@ 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) -- Repository URL: http://hg.python.org/cpython
|