Commit 300fb262 authored by Toby Dickenson's avatar Toby Dickenson

merge toby_directorystorage_tests_branch. Inhibit tests that use versions when...

merge toby_directorystorage_tests_branch. Inhibit tests that use versions when not supported by the storage. Allow a subclass to insert a pause between consecutive packs if needed. DirectoryStorage now passes all the ZODB tests.
parent 505c85e4
...@@ -72,6 +72,8 @@ class HistoryStorage: ...@@ -72,6 +72,8 @@ class HistoryStorage:
eq(d['version'], '') eq(d['version'], '')
def checkVersionHistory(self): def checkVersionHistory(self):
if not self._storage.supportsVersions():
return
eq = self.assertEqual eq = self.assertEqual
# Store a couple of non-version revisions # Store a couple of non-version revisions
oid = self._storage.new_oid() oid = self._storage.new_oid()
...@@ -110,6 +112,8 @@ class HistoryStorage: ...@@ -110,6 +112,8 @@ class HistoryStorage:
eq(d['version'], '') eq(d['version'], '')
def checkHistoryAfterVersionCommit(self): def checkHistoryAfterVersionCommit(self):
if not self._storage.supportsVersions():
return
eq = self.assertEqual eq = self.assertEqual
# Store a couple of non-version revisions # Store a couple of non-version revisions
oid = self._storage.new_oid() oid = self._storage.new_oid()
...@@ -168,6 +172,8 @@ class HistoryStorage: ...@@ -168,6 +172,8 @@ class HistoryStorage:
eq(d['version'], '') eq(d['version'], '')
def checkHistoryAfterVersionAbort(self): def checkHistoryAfterVersionAbort(self):
if not self._storage.supportsVersions():
return
eq = self.assertEqual eq = self.assertEqual
# Store a couple of non-version revisions # Store a couple of non-version revisions
oid = self._storage.new_oid() oid = self._storage.new_oid()
......
...@@ -28,7 +28,8 @@ class PersistentStorage: ...@@ -28,7 +28,8 @@ class PersistentStorage:
self._dostore() self._dostore()
oid = self._storage.new_oid() oid = self._storage.new_oid()
revid = self._dostore(oid) revid = self._dostore(oid)
self._dostore(oid, revid, data=8, version='b') if self._storage.supportsVersions():
self._dostore(oid, revid, data=8, version='b')
oid = self._storage.new_oid() oid = self._storage.new_oid()
revid = self._dostore(oid, data=1) revid = self._dostore(oid, data=1)
revid = self._dostore(oid, revid, data=2) revid = self._dostore(oid, revid, data=2)
......
...@@ -46,10 +46,12 @@ class ReadOnlyStorage: ...@@ -46,10 +46,12 @@ class ReadOnlyStorage:
t = Transaction() t = Transaction()
self.assertRaises(ReadOnlyError, self._storage.tpc_begin, t) self.assertRaises(ReadOnlyError, self._storage.tpc_begin, t)
self.assertRaises(ReadOnlyError, self._storage.abortVersion, if self._storage.supportsVersions():
'', t) self.assertRaises(ReadOnlyError, self._storage.abortVersion,
self.assertRaises(ReadOnlyError, self._storage.commitVersion, '', t)
'', '', t) self.assertRaises(ReadOnlyError, self._storage.commitVersion,
'', '', t)
self.assertRaises(ReadOnlyError, self._storage.store, self.assertRaises(ReadOnlyError, self._storage.store,
'\000' * 8, None, '', '', t) '\000' * 8, None, '', '', t)
......
...@@ -619,6 +619,7 @@ class TransactionalUndoStorage: ...@@ -619,6 +619,7 @@ class TransactionalUndoStorage:
obj = root["key%d" % i] obj = root["key%d" % i]
self.assertEqual(obj.value, i) self.assertEqual(obj.value, i)
root.items() root.items()
self._inter_pack_pause()
def checkPackAfterUndoManyTimes(self): def checkPackAfterUndoManyTimes(self):
db = DB(self._storage) db = DB(self._storage)
...@@ -658,6 +659,12 @@ class TransactionalUndoStorage: ...@@ -658,6 +659,12 @@ class TransactionalUndoStorage:
# never change that. # never change that.
self.assertEqual(rt["test"].value, 3) self.assertEqual(rt["test"].value, 3)
self.assertEqual(rt["test2"].value, 2) self.assertEqual(rt["test2"].value, 2)
self._inter_pack_pause()
def _inter_pack_pause(self):
# DirectoryStorage needs a pause between packs,
# most other storages dont.
pass
def checkTransactionalUndoIterator(self): def checkTransactionalUndoIterator(self):
# check that data_txn set in iterator makes sense # check that data_txn set in iterator makes sense
......
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