summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2010-10-31 03:00:57 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2010-10-31 03:00:57 (GMT)
commitf53a626073a95a3b8a350120eecf43d1f78a5072 (patch)
tree3c7a2fc35f14ac6868eb9f61097aef67f40d199b
parentcc221b2411e89a22fe1216660168829c55e3cd74 (diff)
downloadcpython-f53a626073a95a3b8a350120eecf43d1f78a5072.zip
cpython-f53a626073a95a3b8a350120eecf43d1f78a5072.tar.gz
cpython-f53a626073a95a3b8a350120eecf43d1f78a5072.tar.bz2
issue 10237
After increasing the default timeout for the barrier, the unittest for the default timeout must be adjusted
-rw-r--r--Lib/test/lock_tests.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py
index 9fd0fe7..c543e68 100644
--- a/Lib/test/lock_tests.py
+++ b/Lib/test/lock_tests.py
@@ -604,9 +604,10 @@ class BarrierTests(BaseTestCase):
Tests for Barrier objects.
"""
N = 5
+ defaultTimeout = 0.5
def setUp(self):
- self.barrier = self.barriertype(self.N, timeout=0.5)
+ self.barrier = self.barriertype(self.N, timeout=self.defaultTimeout)
def tearDown(self):
self.barrier.abort()
@@ -775,12 +776,14 @@ class BarrierTests(BaseTestCase):
"""
Test the barrier's default timeout
"""
+ #create a barrier with a low default timeout
+ barrier = self.barriertype(self.N, timeout=0.1)
def f():
- i = self.barrier.wait()
+ i = barrier.wait()
if i == self.N // 2:
# One thread is later than the default timeout of 0.1s.
- time.sleep(0.15)
- self.assertRaises(threading.BrokenBarrierError, self.barrier.wait)
+ time.sleep(0.2)
+ self.assertRaises(threading.BrokenBarrierError, barrier.wait)
self.run_threads(f)
def test_single_thread(self):