[Zodb-checkins] CVS: ZEO/ZEO/tests - testZEO.py:1.16.4.5
Jeremy Hylton
jeremy@zope.com
Thu, 24 Jan 2002 17:20:51 -0500
Update of /cvs-repository/ZEO/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv24298
Modified Files:
Tag: Standby-branch
testZEO.py
Log Message:
Get rid of ZEOTestBase and VersionDependentTests.
The ZEOTestBase provided features now in the StorageTestBase.
The version-dependent tests are a non-issue because this code don't
need to work with Zope 2.3.
=== ZEO/ZEO/tests/testZEO.py 1.16.4.4 => 1.16.4.5 ===
self.storage.pack(t, f, wait=1)
-class ZEOTestBase(StorageTestBase.StorageTestBase):
- """Version of the storage test class that supports ZEO.
-
- For ZEO, we don't always get the serialno/exception for a
- particular store as the return value from the store. But we
- will get no later than the return value from vote.
- """
-
- def _dostore(self, oid=None, revid=None, data=None, version=None,
- already_pickled=0):
- """Do a complete storage transaction.
-
- The defaults are:
- - oid=None, ask the storage for a new oid
- - revid=None, use a revid of ZERO
- - data=None, pickle up some arbitrary data (the integer 7)
- - version=None, use the empty string version
-
- Returns the object's new revision id.
- """
- if oid is None:
- oid = self._storage.new_oid()
- if revid is None:
- revid = ZERO
- if data is None:
- data = MinPO(7)
- if not already_pickled:
- data = StorageTestBase.zodb_pickle(data)
- if version is None:
- version = ''
- # Begin the transaction
- self._storage.tpc_begin(self._transaction)
- # Store an object
- r1 = self._storage.store(oid, revid, data, version,
- self._transaction)
- s1 = self._get_serial(r1)
- # Finish the transaction
- r2 = self._storage.tpc_vote(self._transaction)
- s2 = self._get_serial(r2)
- self._storage.tpc_finish(self._transaction)
- # s1, s2 can be None or dict
- assert not (s1 and s2)
- return s1 and s1[oid] or s2 and s2[oid]
-
- def _get_serial(self, r):
- """Return oid -> serialno dict from sequence of ZEO replies."""
- d = {}
- if r is None:
- return None
- if type(r) == types.StringType:
- raise RuntimeError, "unexpected ZEO response: no oid"
- else:
- for oid, serial in r:
- if isinstance(serial, Exception):
- raise serial
- d[oid] = serial
- return d
-
-# Some of the ZEO tests depend on the version of FileStorage available
-# for the tests. If we run these tests using Zope 2.3, FileStorage
-# doesn't support TransactionalUndo.
-
-if hasattr(FileStorage, 'supportsTransactionalUndo'):
- # XXX Assume that a FileStorage that supports transactional undo
- # also supports conflict resolution.
- class VersionDependentTests(
- TransactionalUndoStorage.TransactionalUndoStorage,
- TransactionalUndoVersionStorage.TransactionalUndoVersionStorage,
- ConflictResolution.ConflictResolvingStorage,
- ConflictResolution.ConflictResolvingTransUndoStorage):
- pass
-else:
- class VersionDependentTests:
- pass
-
-class GenericTests(ZEOTestBase,
- VersionDependentTests,
+class GenericTests(StorageTestBase.StorageTestBase,
+ TransactionalUndoStorage.TransactionalUndoStorage,
+ TransactionalUndoVersionStorage.TransactionalUndoVersionStorage,
+ ConflictResolution.ConflictResolvingStorage,
+ ConflictResolution.ConflictResolvingTransUndoStorage,
Cache.StorageWithCache,
Cache.TransUndoStorageWithCache,
BasicStorage.BasicStorage,
@@ -213,7 +141,7 @@
"""
__super_setUp = StorageTestBase.StorageTestBase.setUp
__super_tearDown = StorageTestBase.StorageTestBase.tearDown
-
+
def setUp(self):
self.__super_setUp()
args = self.getStorageInfo()
@@ -251,7 +179,7 @@
except os.error:
pass
-class ConnectionTests(ZEOTestBase):
+class ConnectionTests(StorageTestBase.StorageTestBase):
"""Tests that explicitly manage the server process.
To test the cache or re-connection, these test cases explicit