[Python-checkins] r86018 - python/branches/py3k/Lib/test/lock_tests.py
kristjan.jonsson
python-checkins at python.org
Sun Oct 31 04:00:58 CET 2010
Author: kristjan.jonsson
Date: Sun Oct 31 04:00:57 2010
New Revision: 86018
Log:
issue 10237
After increasing the default timeout for the barrier, the unittest for the default timeout must be adjusted
Modified:
python/branches/py3k/Lib/test/lock_tests.py
Modified: python/branches/py3k/Lib/test/lock_tests.py
==============================================================================
--- python/branches/py3k/Lib/test/lock_tests.py (original)
+++ python/branches/py3k/Lib/test/lock_tests.py Sun Oct 31 04:00:57 2010
@@ -604,9 +604,10 @@
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 @@
"""
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):
More information about the Python-checkins
mailing list