From 60f14370d3a1ef9da528dd2dce6df63e3a206f49 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Tue, 16 Feb 2010 20:47:20 -0800 Subject: [PATCH] Version-specific test changes, plus name aliasing in db_pool. --- eventlet/db_pool.py | 8 ++++---- tests/stdlib/test_threading.py | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/eventlet/db_pool.py b/eventlet/db_pool.py index 671d6a5..61effe3 100644 --- a/eventlet/db_pool.py +++ b/eventlet/db_pool.py @@ -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 diff --git a/tests/stdlib/test_threading.py b/tests/stdlib/test_threading.py index 1b87e32..915d111 100644 --- a/tests/stdlib/test_threading.py +++ b/tests/stdlib/test_threading.py @@ -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__":