summaryrefslogtreecommitdiff
path: root/test/engine
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-06-22 12:42:01 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-06-22 12:42:01 -0400
commite597d3d14527eb163c6fd78e5e135525fc14c3c8 (patch)
treef9c898dedfcf21bef4ed1344c68ceffb73f6ff0b /test/engine
parent5f0a7bb152b30dd7b05771725a7ffe16e3af8f8a (diff)
downloadsqlalchemy-e597d3d14527eb163c6fd78e5e135525fc14c3c8.tar.gz
- [bug] Fixed bug whereby if a database restart
affected multiple connections, each connection would individually invoke a new disposal of the pool, even though only one disposal is needed. [ticket:2522]
Diffstat (limited to 'test/engine')
-rw-r--r--test/engine/test_reconnect.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/engine/test_reconnect.py b/test/engine/test_reconnect.py
index b545aca52..da9e54292 100644
--- a/test/engine/test_reconnect.py
+++ b/test/engine/test_reconnect.py
@@ -264,6 +264,33 @@ class RealReconnectTest(fixtures.TestBase):
conn.close()
+ def test_multiple_invalidate(self):
+ c1 = engine.connect()
+ c2 = engine.connect()
+
+ eq_(c1.execute(select([1])).scalar(), 1)
+
+ p1 = engine.pool
+ engine.test_shutdown()
+
+ try:
+ c1.execute(select([1]))
+ assert False
+ except tsa.exc.DBAPIError, e:
+ assert e.connection_invalidated
+
+ p2 = engine.pool
+
+ try:
+ c2.execute(select([1]))
+ assert False
+ except tsa.exc.DBAPIError, e:
+ assert e.connection_invalidated
+
+ # pool isn't replaced
+ assert engine.pool is p2
+
+
def test_ensure_is_disconnect_gets_connection(self):
def is_disconnect(e, conn, cursor):
# connection is still present