Version-specific test changes, plus name aliasing in db_pool.

This commit is contained in:
Ryan Williams
2010-02-16 20:47:20 -08:00
parent b95d2e3238
commit 60f14370d3
2 changed files with 8 additions and 5 deletions

View File

@@ -249,13 +249,13 @@ class TpooledConnectionPool(BaseConnectionPool):
@classmethod
def connect(cls, db_module, connect_timeout, *args, **kw):
timeout = timeout.Timeout(connect_timeout, ConnectTimeout())
t = timeout.Timeout(connect_timeout, ConnectTimeout())
try:
from eventlet import tpool
conn = tpool.execute(db_module.connect, *args, **kw)
return tpool.Proxy(conn, autowrap_names=('cursor',))
finally:
timeout.cancel()
t.cancel()
class RawConnectionPool(BaseConnectionPool):
@@ -269,11 +269,11 @@ class RawConnectionPool(BaseConnectionPool):
@classmethod
def connect(cls, db_module, connect_timeout, *args, **kw):
timeout = timeout.Timeout(connect_timeout, ConnectTimeout())
t = timeout.Timeout(connect_timeout, ConnectTimeout())
try:
return db_module.connect(*args, **kw)
finally:
timeout.cancel()
t.cancel()
# default connection pool is the tpool one

View File

@@ -15,7 +15,10 @@ patcher.inject('test.test_threading',
# "PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently)
# exposed at the Python level. This test relies on ctypes to get at it."
# Therefore it's also disabled when testing eventlet, as it's not emulated.
ThreadTests.test_PyThreadState_SetAsyncExc = lambda s: None
try:
ThreadTests.test_PyThreadState_SetAsyncExc = lambda s: None
except (AttributeError, NameError):
pass
if __name__ == "__main__":