Skip to content
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
gh-109401: Fix threading barrier test_default_timeout() (GH-109875)
Increase timeouts. Barrier default timeout should be long enough to
spawn 4 threads on a slow CI.
(cherry picked from commit e5186c3)

Co-authored-by: Victor Stinner <vstinner@python.org>
  • Loading branch information
vstinner authored and miss-islington committed Sep 26, 2023
commit dfb63364d821ba5c3bc8f47e493ff026ff28b428
10 changes: 6 additions & 4 deletions Lib/test/lock_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,13 +1015,15 @@ def test_default_timeout(self):
"""
Test the barrier's default timeout
"""
# create a barrier with a low default timeout
barrier = self.barriertype(self.N, timeout=0.3)
# gh-109401: Barrier timeout should be long enough
# to create 4 threads on a slow CI.
timeout = 1.0
barrier = self.barriertype(self.N, timeout=timeout)
def f():
i = barrier.wait()
if i == self.N // 2:
# One thread is later than the default timeout of 0.3s.
time.sleep(1.0)
# One thread is later than the default timeout.
time.sleep(timeout * 2)
self.assertRaises(threading.BrokenBarrierError, barrier.wait)
self.run_threads(f)

Expand Down