summaryrefslogtreecommitdiff
path: root/test/engine/test_pool.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-11-17 14:35:11 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-11-17 14:35:11 -0500
commit1a809b300e0f77888e4cdac42f9e1662baa169c7 (patch)
tree8cf0a64c3e0cb9f3fc73178daa20018ae8ae9dac /test/engine/test_pool.py
parentc33ae55f5a8962969fbc66ff530b083c00f009cd (diff)
downloadsqlalchemy-1a809b300e0f77888e4cdac42f9e1662baa169c7.tar.gz
- apply a timeout to all join() calls for test_pool
- use thread.join() for waiters_handled test
Diffstat (limited to 'test/engine/test_pool.py')
-rw-r--r--test/engine/test_pool.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/test/engine/test_pool.py b/test/engine/test_pool.py
index d5d384948..a59a040d6 100644
--- a/test/engine/test_pool.py
+++ b/test/engine/test_pool.py
@@ -10,6 +10,8 @@ from sqlalchemy.testing import fixtures
from sqlalchemy.testing.mock import Mock, call
+join_timeout = 10
+
def MockDBAPI():
def cursor():
while True:
@@ -827,7 +829,7 @@ class QueuePoolTest(PoolTestBase):
th.start()
threads.append(th)
for th in threads:
- th.join()
+ th.join(join_timeout)
assert len(timeouts) > 0
for t in timeouts:
@@ -864,7 +866,7 @@ class QueuePoolTest(PoolTestBase):
th.start()
threads.append(th)
for th in threads:
- th.join()
+ th.join(join_timeout)
self.assert_(max(peaks) <= max_overflow)
@@ -897,16 +899,19 @@ class QueuePoolTest(PoolTestBase):
c1 = p.connect()
c2 = p.connect()
+ threads = set()
for i in range(2):
t = threading.Thread(target=waiter,
args=(p, timeout, max_overflow))
- t.setDaemon(True) # so the tests dont hang if this fails
t.start()
+ threads.add(t)
c1.invalidate()
c2.invalidate()
p2 = p._replace()
- time.sleep(.5)
+
+ for t in threads:
+ t.join(join_timeout)
eq_(len(success), 12, "successes: %s" % success)
@@ -1245,7 +1250,7 @@ class SingletonThreadPoolTest(PoolTestBase):
th.start()
threads.append(th)
for th in threads:
- th.join()
+ th.join(join_timeout)
assert len(p._all_conns) == 3
if strong_refs: