summaryrefslogtreecommitdiff
path: root/test/engine/test_reconnect.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-12-04 14:25:00 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-12-04 14:25:00 -0500
commit632043bc8a72651f497396eb17e6f2b19bf98608 (patch)
treeac913a5fda14fa1cf08510f651e0ae8ced31ee98 /test/engine/test_reconnect.py
parent81945d7a0c60cc898541189d52564df2010871c1 (diff)
downloadsqlalchemy-632043bc8a72651f497396eb17e6f2b19bf98608.tar.gz
- [bug] Fixed bug whereby transaction.rollback()
would throw an error on an invalidated connection if the transaction were a two-phase or savepoint transaction. For plain transactions, rollback() is a no-op if the connection is invalidated, so while it wasn't 100% clear if it should be a no-op, at least now the interface is consistent. [ticket:2317]
Diffstat (limited to 'test/engine/test_reconnect.py')
-rw-r--r--test/engine/test_reconnect.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/engine/test_reconnect.py b/test/engine/test_reconnect.py
index 82fe55422..b545aca52 100644
--- a/test/engine/test_reconnect.py
+++ b/test/engine/test_reconnect.py
@@ -280,6 +280,27 @@ class RealReconnectTest(fixtures.TestBase):
conn.execute, select([1])
)
+ def test_rollback_on_invalid_plain(self):
+ conn = engine.connect()
+ trans = conn.begin()
+ conn.invalidate()
+ trans.rollback()
+
+ @testing.requires.two_phase_transactions
+ def test_rollback_on_invalid_twophase(self):
+ conn = engine.connect()
+ trans = conn.begin_twophase()
+ conn.invalidate()
+ trans.rollback()
+
+ @testing.requires.savepoints
+ def test_rollback_on_invalid_savepoint(self):
+ conn = engine.connect()
+ trans = conn.begin()
+ trans2 = conn.begin_nested()
+ conn.invalidate()
+ trans2.rollback()
+
def test_invalidate_twice(self):
conn = engine.connect()
conn.invalidate()