(<eventname>, <fn>), which are applied to the Table
before the reflection process begins.
+- engine
+ - Fixed AssertionPool regression bug. [ticket:2097]
+
- dialect
- Changed exception raised to ArgumentError when an
invalid dialect is specified. [ticket:2060]
class Pool(log.Identified):
"""Abstract base class for connection pools."""
- _no_finalize = False
-
def __init__(self,
creator, recycle=-1, echo=None,
use_threadlocal=False,
def _finalize_fairy(connection, connection_record, pool, ref, echo):
_refs.discard(connection_record)
- if pool._no_finalize:
- return
-
if ref is not None and \
connection_record.fairy is not ref:
return
than desired.
"""
- _no_finalize = True
-
def __init__(self, *args, **kw):
self._conn = None
self._checked_out = False
import sqlalchemy as tsa
from test.lib import TestBase, testing
from test.lib.util import gc_collect, lazy_gc
-from test.lib.testing import eq_
+from test.lib.testing import eq_, assert_raises
mcid = 1
class MockDBAPI(object):
th.join()
assert len(p._all_conns) == 3
+class AssertionPoolTest(PoolTestBase):
+ def test_connect_error(self):
+ dbapi = MockDBAPI()
+ p = pool.AssertionPool(creator = lambda: dbapi.connect('foo.db'))
+ c1 = p.connect()
+ assert_raises(AssertionError, p.connect)
+
+ def test_connect_multiple(self):
+ dbapi = MockDBAPI()
+ p = pool.AssertionPool(creator = lambda: dbapi.connect('foo.db'))
+ c1 = p.connect()
+ c1.close()
+ c2 = p.connect()
+ c2.close()
+
+ c3 = p.connect()
+ assert_raises(AssertionError, p.connect)
+
class NullPoolTest(PoolTestBase):
def test_reconnect(self):
dbapi = MockDBAPI()