[Zope-Checkins] CVS: StandaloneZODB/ZODB/tests - IteratorStorage.py:1.5.4.5
Barry Warsaw
barry@wooz.org
Thu, 24 Jan 2002 15:30:05 -0500
Update of /cvs-repository/StandaloneZODB/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv26306
Modified Files:
Tag: Recovery
IteratorStorage.py
Log Message:
checkClose(): New test of the iterator .close() method. If you try to
continue to iterate after closing, you get an IOError (is this the
best exception to raise?).
checkVersionIterator(): Removed the XXX comment, since FileStorage
passes (but not Berkeley storage).
checkTransactionalUndoIterator() -> checkUndoZombieNonVersion()
Also, fix this test so that before the FileStorage.py patch, it will
fail, but afterward it will succeed (i.e. it tests what it's supposed
to test).
Retained the George Bailey test.
undoTrans(): Removed, YAGNI.
=== StandaloneZODB/ZODB/tests/IteratorStorage.py 1.5.4.4 => 1.5.4.5 ===
self.iter_verify(txniter, [revid1, revid2, revid3], 11)
+ def checkClose(self):
+ self._oid = oid = self._storage.new_oid()
+ revid1 = self._dostore(oid, data=MinPO(11))
+ txniter = self._storage.iterator()
+ txniter.close()
+ self.assertRaises(IOError, txniter.__getitem__, 0)
+
def checkVersionIterator(self):
if not self._storage.supportsVersions():
return
@@ -60,52 +67,41 @@
self._storage.tpc_vote(t)
self._storage.tpc_finish(t)
- # XXX extend these checks. right now, just iterating with CVS
- # FS or Berkeley will fail here, but once fixed we should
- # check that the right data is returned.
txniter = self._storage.iterator()
for trans in txniter:
for data in trans:
pass
- def checkTransactionalUndoIterator(self):
+ def checkUndoZombieNonVersion(self):
if not hasattr(self._storage, 'supportsTransactionalUndo'):
return
if not self._storage.supportsTransactionalUndo():
return
oid = self._storage.new_oid()
- revid = self._dostore(oid, data=MinPO(23))
- revid = self._dostore(oid, revid=revid, data=MinPO(24))
- revid = self._dostore(oid, revid=revid, data=MinPO(25))
-
- self.undoTrans(0)
- self.undoTrans(2)
- self.undoTrans(4)
-
- # XXX extend these checks. right now, just iterating with CVS
- # FS or Berkeley will fail here, but once fixed we should
- # check that the right data is returned.
- txniter = self._storage.iterator()
- for trans in txniter:
- for data in trans:
- pass
-
- # The last transaction performed an undo of the transaction
- # that created object oid. (As Barry points out, the object
- # is now in the George Bailey state.) Assert that the final
- # data record contains None in the data attribute.
- self.assertEqual(data.oid, oid)
- self.assertEqual(data.data, None)
-
- def undoTrans(self, i):
+ revid = self._dostore(oid, data=MinPO(94))
+ # Get the undo information
info = self._storage.undoInfo()
- tid = info[i]['id']
+ tid = info[0]['id']
+ # Undo the creation of the object, rendering it a zombie
t = Transaction()
self._storage.tpc_begin(t)
oids = self._storage.transactionalUndo(tid, t)
self._storage.tpc_vote(t)
self._storage.tpc_finish(t)
+ # Now attempt to iterator over the storage
+ iter = self._storage.iterator()
+ for txn in iter:
+ for rec in txn:
+ pass
+
+ # The last transaction performed an undo of the transaction that
+ # created object oid. (As Barry points out, the object is now in the
+ # George Bailey state.) Assert that the final data record contains
+ # None in the data attribute.
+ self.assertEqual(rec.oid, oid)
+ self.assertEqual(rec.data, None)
+
class ExtendedIteratorStorage(IteratorCompare):