Permalink
Browse files

async test now cleans up after itself

  • Loading branch information...
1 parent e960dc4 commit 63a800626895d1935101bfe73f2f2698267aeba5 @eggspurt eggspurt committed Aug 17, 2012
Showing with 4 additions and 1 deletion.
  1. +3 −1 momoko/pools.py
  2. +1 −0 tests/async_client.py
View
4 momoko/pools.py
@@ -11,7 +11,6 @@
import logging
from functools import partial
-from contextlib import contextmanager
import time
import psycopg2
@@ -206,6 +205,9 @@ def new_cursor(self, function, function_args=(), callback=None, cursor_kwargs={}
.. _connection.cursor: http://initd.org/psycopg/docs/connection.html#connection.cursor
"""
if connection is None:
+ connection = self._get_free_conn()
+
+ if connection is None:
self._new_conn(callback=self.new_cursor, callback_args=[function, function_args, callback, cursor_kwargs])
else:
try:
View
1 tests/async_client.py
@@ -28,6 +28,7 @@ def setUp(self):
})
def tearDown(self):
+ self.db.close()
super(AsyncClientTest, self).tearDown()
def test_single_query(self):

0 comments on commit 63a8006

Please sign in to comment.