Commit 91aebdb7 authored by Jeremy Hylton's avatar Jeremy Hylton

Get rid of warning in checkPackAllRevisions()

parent 6ae3c752
...@@ -103,7 +103,25 @@ class PackableStorageBase: ...@@ -103,7 +103,25 @@ class PackableStorageBase:
class PackableStorage(PackableStorageBase): 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): def checkPackAllRevisions(self):
self._initroot()
eq = self.assertEqual eq = self.assertEqual
raises = self.assertRaises raises = self.assertRaises
# Create a `persistent' object # Create a `persistent' object
...@@ -138,6 +156,7 @@ class PackableStorage(PackableStorageBase): ...@@ -138,6 +156,7 @@ class PackableStorage(PackableStorageBase):
raises(KeyError, self._storage.loadSerial, oid, revid3) raises(KeyError, self._storage.loadSerial, oid, revid3)
def checkPackJustOldRevisions(self): def checkPackJustOldRevisions(self):
self._initroot()
eq = self.assertEqual eq = self.assertEqual
raises = self.assertRaises raises = self.assertRaises
loads = self._makeloader() loads = self._makeloader()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment