Skip to content

Commit 8195049

Browse files
authored
bpo-32692: Fix test_threading.test_set_and_clear() (GH-8331)
Increase the timeout: give timeout x 4 instead of timeout x 2 to threads to wait until the Event is set, but reduce the sleep from 500 ms to 250 ms. So the test should be more reliable and faster!
1 parent 686b4b5 commit 8195049

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/lock_tests.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,13 @@ def test_set_and_clear(self):
405405
# cleared before the waiting thread is woken up.
406406
evt = self.eventtype()
407407
results = []
408+
timeout = 0.250
408409
N = 5
409410
def f():
410-
results.append(evt.wait(1))
411+
results.append(evt.wait(timeout * 4))
411412
b = Bunch(f, N)
412413
b.wait_for_started()
413-
time.sleep(0.5)
414+
time.sleep(timeout)
414415
evt.set()
415416
evt.clear()
416417
b.wait_for_finished()

0 commit comments

Comments
 (0)