[Zodb-checkins] CVS: StandaloneZODB/ZODB/tests - PackableStorage.py:1.7

Jeremy Hylton jeremy@zope.com
Tue, 2 Oct 2001 16:22:35 -0400


Update of /cvs-repository/StandaloneZODB/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv24001/tests

Modified Files:
	PackableStorage.py 
Log Message:
Get rid of warning in checkPackAllRevisions()


=== StandaloneZODB/ZODB/tests/PackableStorage.py 1.6 => 1.7 ===
 
 class PackableStorage(PackableStorageBase):
+    def _initroot(self):
+        try:
+            self._storage.load('\0\0\0\0\0\0\0\0','')
+        except KeyError:
+            import PersistentMapping
+            file = StringIO()
+            p = Pickler(file, 1)
+            p.dump((PersistentMapping.PersistentMapping, None))
+            p.dump({'_container': {}})
+            t=Transaction()
+            t.description='initial database creation'
+            self._storage.tpc_begin(t)
+            self._storage.store('\0\0\0\0\0\0\0\0',
+                                None, file.getvalue(), '', t)
+            self._storage.tpc_vote(t)
+            self._storage.tpc_finish(t)
+            
     def checkPackAllRevisions(self):
+        self._initroot()
         eq = self.assertEqual
         raises = self.assertRaises
         # Create a `persistent' object
@@ -138,6 +156,7 @@
         raises(KeyError, self._storage.loadSerial, oid, revid3)
 
     def checkPackJustOldRevisions(self):
+        self._initroot()
         eq = self.assertEqual
         raises = self.assertRaises
         loads = self._makeloader()