Issue #11871: In test_threading.BarrierTests, bump the default barrier timeout

to avoid timing-dependent failures.
This commit is contained in:
Charles-François Natali 2011-07-27 21:28:23 +02:00
commit fd96eb2a68
1 changed files with 3 additions and 3 deletions

View File

@ -834,12 +834,12 @@ class BarrierTests(BaseTestCase):
""" """
Test the barrier's default timeout Test the barrier's default timeout
""" """
#create a barrier with a low default timeout # create a barrier with a low default timeout
barrier = self.barriertype(self.N, timeout=0.1) barrier = self.barriertype(self.N, timeout=0.3)
def f(): def f():
i = barrier.wait() i = barrier.wait()
if i == self.N // 2: if i == self.N // 2:
# One thread is later than the default timeout of 0.1s. # One thread is later than the default timeout of 0.3s.
time.sleep(1.0) time.sleep(1.0)
self.assertRaises(threading.BrokenBarrierError, barrier.wait) self.assertRaises(threading.BrokenBarrierError, barrier.wait)
self.run_threads(f) self.run_threads(f)