Version-specific test changes, plus name aliasing in db_pool.
This commit is contained in:
@@ -249,13 +249,13 @@ class TpooledConnectionPool(BaseConnectionPool):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def connect(cls, db_module, connect_timeout, *args, **kw):
|
def connect(cls, db_module, connect_timeout, *args, **kw):
|
||||||
timeout = timeout.Timeout(connect_timeout, ConnectTimeout())
|
t = timeout.Timeout(connect_timeout, ConnectTimeout())
|
||||||
try:
|
try:
|
||||||
from eventlet import tpool
|
from eventlet import tpool
|
||||||
conn = tpool.execute(db_module.connect, *args, **kw)
|
conn = tpool.execute(db_module.connect, *args, **kw)
|
||||||
return tpool.Proxy(conn, autowrap_names=('cursor',))
|
return tpool.Proxy(conn, autowrap_names=('cursor',))
|
||||||
finally:
|
finally:
|
||||||
timeout.cancel()
|
t.cancel()
|
||||||
|
|
||||||
|
|
||||||
class RawConnectionPool(BaseConnectionPool):
|
class RawConnectionPool(BaseConnectionPool):
|
||||||
@@ -269,11 +269,11 @@ class RawConnectionPool(BaseConnectionPool):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def connect(cls, db_module, connect_timeout, *args, **kw):
|
def connect(cls, db_module, connect_timeout, *args, **kw):
|
||||||
timeout = timeout.Timeout(connect_timeout, ConnectTimeout())
|
t = timeout.Timeout(connect_timeout, ConnectTimeout())
|
||||||
try:
|
try:
|
||||||
return db_module.connect(*args, **kw)
|
return db_module.connect(*args, **kw)
|
||||||
finally:
|
finally:
|
||||||
timeout.cancel()
|
t.cancel()
|
||||||
|
|
||||||
|
|
||||||
# default connection pool is the tpool one
|
# 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)
|
# "PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently)
|
||||||
# exposed at the Python level. This test relies on ctypes to get at it."
|
# 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.
|
# 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__":
|
if __name__ == "__main__":
|
||||||
|
Reference in New Issue
Block a user