Version-specific test changes, plus name aliasing in db_pool.
This commit is contained in:
@@ -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
|
||||
|
@@ -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__":
|
||||
|
Reference in New Issue
Block a user