Commit 07b977dd authored by Jeremy Hylton's avatar Jeremy Hylton

Always abort a transaction that raised an exception.

parent ec6c4a89
...@@ -67,9 +67,10 @@ class SynchronizedStorage: ...@@ -67,9 +67,10 @@ class SynchronizedStorage:
apply(self.assertRaises, args) apply(self.assertRaises, args)
def verifyWrongTrans(self, callable, *args): def verifyWrongTrans(self, callable, *args):
self._storage.tpc_begin(Transaction()) t = Transaction()
args = (StorageTransactionError, callable) + args self._storage.tpc_begin(t)
apply(self.assertRaises, args) self.assertRaises(StorageTransactionError, callable, *args)
self._storage.tpc_abort(t)
def checkAbortVersionNotCommitting(self): def checkAbortVersionNotCommitting(self):
self.verifyNotCommitting(self._storage.abortVersion, self.verifyNotCommitting(self._storage.abortVersion,
......
...@@ -199,9 +199,12 @@ class VersionStorage: ...@@ -199,9 +199,12 @@ class VersionStorage:
eq(zodb_unpickle(data), MinPO(54)) eq(zodb_unpickle(data), MinPO(54))
t = Transaction() t = Transaction()
self._storage.tpc_begin(t) self._storage.tpc_begin(t)
self.assertRaises(POSException.VersionCommitError, try:
self._storage.commitVersion, self.assertRaises(POSException.VersionCommitError,
'one', 'one', t) self._storage.commitVersion,
'one', 'one', t)
finally:
self._storage.tpc_abort(t)
def checkModifyAfterAbortVersion(self): def checkModifyAfterAbortVersion(self):
eq = self.assertEqual eq = self.assertEqual
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment