Commit e485bfad authored by Jeremy Hylton's avatar Jeremy Hylton

Move checkLoadSerial to RevisionStorage from BasicStorage.

It's possible for a storage to not support historical revisions, in
which case this test can't work.

Also make comment at top of BasicStorage into a doc string.
parent 545d2e38
# Run the basic tests for a storage as described in the official storage API: """Run the basic tests for a storage as described in the official storage API
#
# http://www.zope.org/Documentation/Developer/Models/ZODB/ZODB_Architecture_Storage_Interface_Info.html The most complete and most out-of-date description of the interface is:
# http://www.zope.org/Documentation/Developer/Models/ZODB/ZODB_Architecture_Storage_Interface_Info.html
# All storages should be able to pass these tests
All storages should be able to pass these tests.
"""
from ZODB.Transaction import Transaction from ZODB.Transaction import Transaction
from ZODB import POSException from ZODB import POSException
...@@ -89,18 +91,6 @@ class BasicStorage: ...@@ -89,18 +91,6 @@ class BasicStorage:
self._dostore(oid=oid) self._dostore(oid=oid)
self.assertEqual(self._storage.modifiedInVersion(oid), '') self.assertEqual(self._storage.modifiedInVersion(oid), '')
def checkLoadSerial(self):
oid = self._storage.new_oid()
revid = ZERO
revisions = {}
for i in range(31, 38):
revid = self._dostore(oid, revid=revid, data=MinPO(i))
revisions[revid] = MinPO(i)
# Now make sure all the revisions have the correct value
for revid, value in revisions.items():
data = self._storage.loadSerial(oid, revid)
self.assertEqual(zodb_unpickle(data), value)
def checkConflicts(self): def checkConflicts(self):
oid = self._storage.new_oid() oid = self._storage.new_oid()
revid1 = self._dostore(oid, data=MinPO(11)) revid1 = self._dostore(oid, data=MinPO(11))
......
"""Check loadSerial() on storages that support historical revisions."""
from ZODB.tests.MinPO import MinPO
from ZODB.tests.StorageTestBase import zodb_unpickle, zodb_pickle
ZERO = '\0'*8
class RevisionStorage:
def checkLoadSerial(self):
oid = self._storage.new_oid()
revid = ZERO
revisions = {}
for i in range(31, 38):
revid = self._dostore(oid, revid=revid, data=MinPO(i))
revisions[revid] = MinPO(i)
# Now make sure all the revisions have the correct value
for revid, value in revisions.items():
data = self._storage.loadSerial(oid, revid)
self.assertEqual(zodb_unpickle(data), value)
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