]> granicus.if.org Git - python/commitdiff
bpo-32692: Fix test_threading.test_set_and_clear() (GH-8331)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 19 Jul 2018 09:44:29 +0000 (02:44 -0700)
committerGitHub <noreply@github.com>
Thu, 19 Jul 2018 09:44:29 +0000 (02:44 -0700)
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!
(cherry picked from commit 81950495ba2c36056e0ce48fd37d514816c26747)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
Lib/test/lock_tests.py

index 5b1f033c6f806d5d2900afee9152b4093e38b7e8..65fa4d87d4ce38a4cfbf3fbd9158aa6c1e15e0c0 100644 (file)
@@ -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()