[Zope-Checkins] CVS: ZODB3/ZODB/tests - PackableStorage.py:1.13.8.4

Tim Peters tim.one at comcast.net
Thu Aug 14 18:46:07 EDT 2003


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

Modified Files:
      Tag: ZODB3-3_1-branch
	PackableStorage.py 
Log Message:
Added new test checkPackUndoLog(), backported from the ZODB3 HEAD.


=== ZODB3/ZODB/tests/PackableStorage.py 1.13.8.3 => 1.13.8.4 ===
--- ZODB3/ZODB/tests/PackableStorage.py:1.13.8.3	Thu Aug 14 15:11:43 2003
+++ ZODB3/ZODB/tests/PackableStorage.py	Thu Aug 14 17:46:02 2003
@@ -435,6 +435,27 @@
     def checkPackNowWhileWriting(self):
         self._PackWhileWriting(pack_now=1)
 
+    def checkPackUndoLog(self):
+        self._initroot()
+        eq = self.assertEqual
+        raises = self.assertRaises
+        # Create a `persistent' object
+        obj = self._newobj()
+        oid = obj.getoid()
+        obj.value = 1
+        # Commit two different revisions
+        revid1 = self._dostoreNP(oid, data=pickle.dumps(obj))
+        obj.value = 2
+        snooze()
+        packtime = time.time()
+        snooze()
+        revid2 = self._dostoreNP(oid, revid=revid1, data=pickle.dumps(obj))
+        # Now pack the first transaction
+        self.assertEqual(3,len(self._storage.undoLog()))
+        self._storage.pack(packtime, referencesf)
+        # The undo log contains only the most resent transaction
+        self.assertEqual(1,len(self._storage.undoLog()))
+
 
 class ClientThread(threading.Thread):
 




More information about the Zope-Checkins mailing list