]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-109840: Fix multiprocessing test_waitfor_timeout() (#110428)
authorVictor Stinner <vstinner@python.org>
Thu, 5 Oct 2023 19:32:06 +0000 (21:32 +0200)
committerGitHub <noreply@github.com>
Thu, 5 Oct 2023 19:32:06 +0000 (19:32 +0000)
Don't measure the CI performance: don't fail if cond.wait_for() takes
longer than 1 second on a slow CI.

Lib/test/_test_multiprocessing.py

index 39666dd331db0bfd603c571354a87eba8dc48d83..d3e713594b0f4b219a46b5c8b438f908092e80cd 100644 (file)
@@ -1651,12 +1651,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')
@@ -1675,7 +1675,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()