[Zodb-checkins] CVS: Zope/lib/python/ZODB/tests - TransactionalUndoVersionStorage.py:1.7
Jeremy Hylton
jeremy@zope.com
Tue, 18 Jun 2002 12:55:52 -0400
Update of /cvs-repository/Zope/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv8987
Modified Files:
TransactionalUndoVersionStorage.py
Log Message:
Make tests runnable with ZEO 1.0 distributed separately from Zope.
The old ZEO test suite does not accept description as a keyword arg.
Luckily the description is only there to help debug problems; it isn't
required for successful completion of the test.
=== Zope/lib/python/ZODB/tests/TransactionalUndoVersionStorage.py 1.6 => 1.7 ===
class TransactionalUndoVersionStorage:
+
+ def _x_dostore(self, *args, **kwargs):
+ # ugh: backwards compatibilty for ZEO 1.0 which runs these
+ # tests but has a _dostore() method that does not support the
+ # description kwarg.
+ try:
+ return self._dostore(*args, **kwargs)
+ except TypeError:
+ # assume that the type error means we've got a _dostore()
+ # without the description kwarg
+ try:
+ del kwargs['description']
+ except KeyError:
+ pass # not expected
+ return self._dostore(*args, **kwargs)
+
def checkUndoInVersion(self):
oid = self._storage.new_oid()
version = 'one'
@@ -110,18 +126,18 @@
oid = self._storage.new_oid()
revid = '\000' * 8
for i in range(4):
- revid = self._dostore(oid, revid, description='packable%d' % i)
+ revid = self._x_dostore(oid, revid, description='packable%d' % i)
pt = time.time()
time.sleep(1)
oid1 = self._storage.new_oid()
version = 'version'
- revid1 = self._dostore(oid1, data=MinPO(0), description='create1')
- revid2 = self._dostore(oid1, data=MinPO(1), revid=revid1,
+ revid1 = self._x_dostore(oid1, data=MinPO(0), description='create1')
+ revid2 = self._x_dostore(oid1, data=MinPO(1), revid=revid1,
version=version, description='version1')
- revid3 = self._dostore(oid1, data=MinPO(2), revid=revid2,
+ revid3 = self._x_dostore(oid1, data=MinPO(2), revid=revid2,
version=version, description='version2')
- self._dostore(description='create2')
+ self._x_dostore(description='create2')
t = Transaction()
t.description = 'commit version'
@@ -157,18 +173,18 @@
oid = self._storage.new_oid()
revid = '\000' * 8
for i in range(3):
- revid = self._dostore(oid, revid, description='packable%d' % i)
+ revid = self._x_dostore(oid, revid, description='packable%d' % i)
pt = time.time()
time.sleep(1)
oid1 = self._storage.new_oid()
version = 'version'
- revid1 = self._dostore(oid1, data=MinPO(0), description='create1')
- revid2 = self._dostore(oid1, data=MinPO(1), revid=revid1,
+ revid1 = self._x_dostore(oid1, data=MinPO(0), description='create1')
+ revid2 = self._x_dostore(oid1, data=MinPO(1), revid=revid1,
version=version, description='version1')
- revid3 = self._dostore(oid1, data=MinPO(2), revid=revid2,
+ revid3 = self._x_dostore(oid1, data=MinPO(2), revid=revid2,
version=version, description='version2')
- self._dostore(description='create2')
+ self._x_dostore(description='create2')
t = Transaction()
t.description = 'abort version'