[Zodb-checkins] CVS: StandaloneZODB/ZEO/tests - testZEO.py:1.16.4.4.2.4
Jeremy Hylton
jeremy@zope.com
Mon, 6 May 2002 14:21:29 -0400
Update of /cvs-repository/StandaloneZODB/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv6035/tests
Modified Files:
Tag: ZEO2-branch
testZEO.py
Log Message:
Re-enable to commit tests now that they work.
=== StandaloneZODB/ZEO/tests/testZEO.py 1.16.4.4.2.3 => 1.16.4.4.2.4 ===
self._dostore(data=obj)
-## def checkCommitLockOnCommit(self):
-## self._checkCommitLock("tpc_finish")
+ def checkCommitLockOnCommit(self):
+ try:
+ self._checkCommitLock("tpc_finish")
+ finally:
+ self._cleanup()
+
+ def checkCommitLockOnAbort(self):
+ try:
+ self._checkCommitLock("tpc_abort")
+ finally:
+ self._cleanup()
-## def checkCommitLockOnAbort(self):
-## self._checkCommitLock("tpc_abort")
+ def _cleanup(self):
+ for store, trans in self._storages:
+ store.tpc_abort(trans)
+ store.close()
+ self._storages = []
def _checkCommitLock(self, method_name):
# check the commit lock when a client attemps a transaction,
@@ -123,9 +135,12 @@
for i in range(3):
storage2 = self._duplicate_client()
t2 = Transaction()
- tid = ZEO.ClientStorage.get_timestamp()
- storage2._server.tpc_begin(tid, t2.user, t2.description,
- t2._extension, None, ' ')
+ tid = `ZEO.ClientStorage.get_timestamp()`
+ try:
+ storage2._server.tpc_begin(tid, t2.user, t2.description,
+ t2._extension, None, ' ')
+ except Disconnected:
+ self.fail("client %d disconnected!" % i)
if i == 0:
storage2.close()
else:
@@ -134,12 +149,9 @@
oid = self._storage.new_oid()
self._storage.store(oid, None, '', '', t)
self._storage.tpc_vote(t)
- self._storage.status()
self._storage.tpc_finish(t)
- for store, trans in self._storages:
- store.tpc_abort(trans)
- store.close()
+ self._cleanup()
# Make sure the server is still responsive
self._dostore()