summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWouter Bolsterlee <uws@xs4all.nl>2013-06-07 23:47:05 +0200
committerWouter Bolsterlee <uws@xs4all.nl>2013-06-07 23:47:05 +0200
commit1e84dec0c33dd3825e60e44e7745963d4bb8918b (patch)
tree8f447274909246ae611a27e7d5f62ecf2bfa0e64
parentf789d0194b2e75264c0d31eb832288f72469d914 (diff)
parent4daef2bb43f7fdadba4594d9e099ff85f7b0393b (diff)
downloadhappybase-1e84dec0c33dd3825e60e44e7745963d4bb8918b.tar.gz
Reduce runtime for connection pool tests; add more random failures
-rw-r--r--tests/test_api.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/test_api.py b/tests/test_api.py
index c3c7022..f2deaaf 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -477,11 +477,12 @@ def test_connection_pool():
assert connection is another_connection
# Fake an exception once in a while
- if random.random() < .001:
+ if random.random() < .25:
+ print "Introducing random failure"
connection.transport.close()
raise TTransportException("Fake transport exception")
- for i in xrange(100):
+ for i in xrange(50):
with pool.connection() as connection:
connection.tables()
@@ -497,7 +498,7 @@ def test_connection_pool():
print "Thread %s done" % name
- N_THREADS = 50
+ N_THREADS = 10
pool = ConnectionPool(size=3, **connection_kwargs)
threads = [threading.Thread(target=run) for i in xrange(N_THREADS)]