Skip to content

Commit a24531d

Browse files
committed
gh-109401: Fix threading barrier test_default_timeout()
Increase timeouts. Barrier default timeout should be long enough to spawn 4 threads on a slow CI.
1 parent d73c12b commit a24531d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Lib/test/lock_tests.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1014,13 +1014,15 @@ def test_default_timeout(self):
10141014
"""
10151015
Test the barrier's default timeout
10161016
"""
1017-
# create a barrier with a low default timeout
1018-
barrier = self.barriertype(self.N, timeout=0.3)
1017+
# gh-109401: Barrier timeout should be long enough
1018+
# to create 4 threads on a slow CI.
1019+
timeout = 1.0
1020+
barrier = self.barriertype(self.N, timeout=timeout)
10191021
def f():
10201022
i = barrier.wait()
10211023
if i == self.N // 2:
1022-
# One thread is later than the default timeout of 0.3s.
1023-
time.sleep(1.0)
1024+
# One thread is later than the default timeout.
1025+
time.sleep(timeout * 2)
10241026
self.assertRaises(threading.BrokenBarrierError, barrier.wait)
10251027
self.run_threads(f)
10261028

0 commit comments

Comments
 (0)