[Zodb-checkins] CVS: ZODB3/ZODB/tests - IteratorStorage.py:1.17.2.1

Jeremy Hylton cvs-admin at zope.org
Wed Nov 5 23:34:16 EST 2003


Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv28251/ZODB/tests

Modified Files:
      Tag: ZODB3-mvcc-2-branch
	IteratorStorage.py 
Log Message:
Add loadEx() call that returns data, serial, and tid.

Th new ZEO cache is going to need the tid associated with an object in
addition to its serial number, since it can't guarantee that they are
the same.

The new tests fail for storages other that File and Mapping, because I
haven't implemented loadEx() for them.


=== ZODB3/ZODB/tests/IteratorStorage.py 1.17 => 1.17.2.1 ===
--- ZODB3/ZODB/tests/IteratorStorage.py:1.17	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/IteratorStorage.py	Wed Nov  5 23:33:44 2003
@@ -147,6 +147,23 @@
         finally:
             self._storage.tpc_finish(t)
 
+    def checkLoadEx(self):
+        oid = self._storage.new_oid()
+        self._dostore(oid)
+        data, serial, tid = self._storage.loadEx(oid, "")
+        # In most storages, serial == tid, but that's not a required
+        # part of the API.  The API goes out of its way to avoid
+        # exposing the transaction.  The best we can do is get it
+        # from an iterator.
+        match = False
+        for txn in self._storage.iterator():
+            for rec in txn:
+                if rec.oid == oid and rec.serial == serial:
+                    self.assertEqual(txn.tid, tid)
+                    match = True
+        if not match:
+            self.fail("Could not find transaction with matching id")
+
 
 class ExtendedIteratorStorage(IteratorCompare):
 




More information about the Zodb-checkins mailing list