Skip to content

Commit 11137d3

Browse files
[3.12] gh-109840: Fix multiprocessing test_waitfor_timeout() (GH-110428) (#110430)
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 5eae8dc) Co-authored-by: Victor Stinner <[email protected]>
1 parent 2ab41c8 commit 11137d3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/test/_test_multiprocessing.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1651,12 +1651,12 @@ def test_waitfor(self):
16511651
def _test_waitfor_timeout_f(cls, cond, state, success, sem):
16521652
sem.release()
16531653
with cond:
1654-
expected = 0.1
1654+
expected = 0.100
16551655
dt = time.monotonic()
16561656
result = cond.wait_for(lambda : state.value==4, timeout=expected)
16571657
dt = time.monotonic() - dt
16581658
# borrow logic in assertTimeout() from test/lock_tests.py
1659-
if not result and expected * 0.6 < dt < expected * 10.0:
1659+
if not result and expected * 0.6 <= dt:
16601660
success.value = True
16611661

16621662
@unittest.skipUnless(HAS_SHAREDCTYPES, 'needs sharedctypes')
@@ -1675,7 +1675,7 @@ def test_waitfor_timeout(self):
16751675

16761676
# Only increment 3 times, so state == 4 is never reached.
16771677
for i in range(3):
1678-
time.sleep(0.01)
1678+
time.sleep(0.010)
16791679
with cond:
16801680
state.value += 1
16811681
cond.notify()

0 commit comments

Comments
 (0)