Skip to content

gh-109840: Fix multiprocessing test_waitfor_timeout() #110428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1651,12 +1651,12 @@ def test_waitfor(self):
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')
Expand All @@ -1675,7 +1675,7 @@ def test_waitfor_timeout(self):

# 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()
Expand Down