[Zodb-checkins] CVS: Zope3/src/zodb/storage/tests - recovery.py:1.4.4.2

Jeremy Hylton jeremy@zope.com
Mon, 10 Mar 2003 18:06:43 -0500


Update of /cvs-repository/Zope3/src/zodb/storage/tests
In directory cvs.zope.org:/tmp/cvs-serv25927/storage/tests

Modified Files:
      Tag: opaque-pickles-branch
	recovery.py 
Log Message:
Add test that iteration produces valid .refs attribute.
Close a few iterators.


=== Zope3/src/zodb/storage/tests/recovery.py 1.4.4.1 => 1.4.4.2 ===
--- Zope3/src/zodb/storage/tests/recovery.py:1.4.4.1	Mon Mar 10 14:40:15 2003
+++ Zope3/src/zodb/storage/tests/recovery.py	Mon Mar 10 18:06:41 2003
@@ -23,6 +23,7 @@
 from zodb.ztransaction import Transaction
 from zodb.storage.tests.iterator import IteratorDeepCompare
 from zodb.storage.tests.base import MinPO, zodb_unpickle
+from zodb.serialize import findrefs
 
 
 class RecoveryStorage(IteratorDeepCompare):
@@ -76,6 +77,7 @@
             self.assertRaises(StopIteration, txniter.next)
             self.assertEqual(data.oid, oid)
             self.assertEqual(data.data, None)
+            siter.close()
 
     def checkRecoverUndoInVersion(self):
         oid = self._storage.newObjectId()
@@ -150,13 +152,16 @@
 
         # copy the final transaction manually.  even though there
         # was a pack, the restore() ought to succeed.
-        final = list(self._storage.iterator())[-1]
+        iter = self._storage.iterator()
+        final = list(iter)[-1]
         self._dst.tpcBegin(final, final.tid, final.status)
         for r in final:
+            self.assertEqual(findrefs(r.data), list(r.refs))
             self._dst.restore(r.oid, r.serial, r.data, r.version, r.data_txn,
-                              final)
+                              r.refs, final)
         self._dst.tpcVote(final)
         self._dst.tpcFinish(final)
+        iter.close()
 
     def checkPackWithGCOnDestinationAfterRestore(self):
         raises = self.assertRaises