summaryrefslogtreecommitdiffstats
path: root/Lib/test/lock_tests.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-07-19 08:49:58 (GMT)
committerGitHub <noreply@github.com>2018-07-19 08:49:58 (GMT)
commit81950495ba2c36056e0ce48fd37d514816c26747 (patch)
tree44d5ad46330fe8a3718addeff523c091ff9d8eb4 /Lib/test/lock_tests.py
parent686b4b5ff219ed66714f3b811815776dafadc23b (diff)
downloadcpython-81950495ba2c36056e0ce48fd37d514816c26747.zip
cpython-81950495ba2c36056e0ce48fd37d514816c26747.tar.gz
cpython-81950495ba2c36056e0ce48fd37d514816c26747.tar.bz2
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!
Diffstat (limited to 'Lib/test/lock_tests.py')
-rw-r--r--Lib/test/lock_tests.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py
index 5b1f033..65fa4d8 100644
--- a/Lib/test/lock_tests.py
+++ b/Lib/test/lock_tests.py
@@ -405,12 +405,13 @@ class EventTests(BaseTestCase):
# cleared before the waiting thread is woken up.
evt = self.eventtype()
results = []
+ timeout = 0.250
N = 5
def f():
- results.append(evt.wait(1))
+ results.append(evt.wait(timeout * 4))
b = Bunch(f, N)
b.wait_for_started()
- time.sleep(0.5)
+ time.sleep(timeout)
evt.set()
evt.clear()
b.wait_for_finished()