From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 5 Oct 2023 19:53:14 +0000 (-0700) Subject: [3.11] gh-109840: Fix multiprocessing test_waitfor_timeout() (GH-110428) (#110431) X-Git-Tag: v3.11.7~243 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a503bdf21fefb61999d1b4afdd288156b3138655;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-109840: Fix multiprocessing test_waitfor_timeout() (GH-110428) (#110431) gh-109840: Fix multiprocessing test_waitfor_timeout() (GH-110428) Don't measure the CI performance: don't fail if cond.wait_for() takes longer than 1 second on a slow CI. (cherry picked from commit 5eae8dc2cb832af6ae1ee340fb0194107fe3bd6e) Co-authored-by: Victor Stinner --- diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 6459757eb93d..42441fed79bf 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -1650,12 +1650,12 @@ class _TestCondition(BaseTestCase): def _test_waitfor_timeout_f(cls, cond, state, success, sem): sem.release() with cond: - expected = 0.1 + expected = 0.100 dt = time.monotonic() result = cond.wait_for(lambda : state.value==4, timeout=expected) dt = time.monotonic() - dt # borrow logic in assertTimeout() from test/lock_tests.py - if not result and expected * 0.6 < dt < expected * 10.0: + if not result and expected * 0.6 <= dt: success.value = True @unittest.skipUnless(HAS_SHAREDCTYPES, 'needs sharedctypes') @@ -1674,7 +1674,7 @@ class _TestCondition(BaseTestCase): # Only increment 3 times, so state == 4 is never reached. for i in range(3): - time.sleep(0.01) + time.sleep(0.010) with cond: state.value += 1 cond.notify()