summaryrefslogtreecommitdiff
path: root/test/aaa_profiling/test_pool.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-06-10 21:18:24 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-06-10 21:18:24 +0000
commit45cec095b4904ba71425d2fe18c143982dd08f43 (patch)
treeaf5e540fdcbf1cb2a3337157d69d4b40be010fa8 /test/aaa_profiling/test_pool.py
parent698a3c1ac665e7cd2ef8d5ad3ebf51b7fe6661f4 (diff)
downloadsqlalchemy-45cec095b4904ba71425d2fe18c143982dd08f43.tar.gz
- unit tests have been migrated from unittest to nose.
See README.unittests for information on how to run the tests. [ticket:970]
Diffstat (limited to 'test/aaa_profiling/test_pool.py')
-rw-r--r--test/aaa_profiling/test_pool.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/aaa_profiling/test_pool.py b/test/aaa_profiling/test_pool.py
new file mode 100644
index 000000000..7bb61deb2
--- /dev/null
+++ b/test/aaa_profiling/test_pool.py
@@ -0,0 +1,40 @@
+from sqlalchemy import *
+from sqlalchemy.test import *
+from sqlalchemy.pool import QueuePool
+
+
+class QueuePoolTest(TestBase, AssertsExecutionResults):
+ class Connection(object):
+ def close(self):
+ pass
+
+ def setup(self):
+ global pool
+ pool = QueuePool(creator=self.Connection,
+ pool_size=3, max_overflow=-1,
+ use_threadlocal=True)
+
+
+ @profiling.function_call_count(54, {'2.4': 38})
+ def test_first_connect(self):
+ conn = pool.connect()
+
+ def test_second_connect(self):
+ conn = pool.connect()
+ conn.close()
+
+ @profiling.function_call_count(31, {'2.4': 21})
+ def go():
+ conn2 = pool.connect()
+ return conn2
+ c2 = go()
+
+ def test_second_samethread_connect(self):
+ conn = pool.connect()
+
+ @profiling.function_call_count(5, {'2.4': 3})
+ def go():
+ return pool.connect()
+ c2 = go()
+
+