[Zodb-checkins] CVS: ZODB3/ZODB/tests - BasicStorage.py:1.26.10.1 ConflictResolution.py:1.11.10.1 HistoryStorage.py:1.11.10.1 MTStorage.py:1.11.10.1 MinPO.py:1.4.10.1 PackableStorage.py:1.23.8.1 StorageTestBase.py:1.29.10.1 TransactionalUndoStorage.py:1.34.4.1 TransactionalUndoVersionStorage.py:1.13.4.1 VersionStorage.py:1.25.10.1 dangle.py:1.2.10.1 speed.py:1.4.126.1 testCache.py:1.16.4.1 testPersistentList.py:1.4.10.1 testPersistentMapping.py:1.6.10.1 testRecover.py:1.4.10.1 testTimeStamp.py:1.5.10.1 testTransaction.py:1.15.2.1 testZODB.py:1.17.4.1

Jeremy Hylton cvs-admin at zope.org
Tue Nov 25 15:32:15 EST 2003


Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv27679/ZODB/tests

Modified Files:
      Tag: Zope-2_8-devel-branch
	BasicStorage.py ConflictResolution.py HistoryStorage.py 
	MTStorage.py MinPO.py PackableStorage.py StorageTestBase.py 
	TransactionalUndoStorage.py TransactionalUndoVersionStorage.py 
	VersionStorage.py dangle.py speed.py testCache.py 
	testPersistentList.py testPersistentMapping.py testRecover.py 
	testTimeStamp.py testTransaction.py testZODB.py 
Log Message:
Merge changes from zodb33-devel-branch.

One problem to resolve: some tests expect the pickle cache to have a
clear() method.


=== ZODB3/ZODB/tests/BasicStorage.py 1.26 => 1.26.10.1 ===
--- ZODB3/ZODB/tests/BasicStorage.py:1.26	Thu Oct  2 20:34:32 2003
+++ ZODB3/ZODB/tests/BasicStorage.py	Tue Nov 25 15:32:13 2003
@@ -114,7 +114,7 @@
     def checkConflicts(self):
         oid = self._storage.new_oid()
         revid1 = self._dostore(oid, data=MinPO(11))
-        revid2 = self._dostore(oid, revid=revid1, data=MinPO(12))
+        self._dostore(oid, revid=revid1, data=MinPO(12))
         self.assertRaises(POSException.ConflictError,
                           self._dostore,
                           oid, revid=revid1, data=MinPO(13))


=== ZODB3/ZODB/tests/ConflictResolution.py 1.11 => 1.11.10.1 ===
--- ZODB3/ZODB/tests/ConflictResolution.py:1.11	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/ConflictResolution.py	Tue Nov 25 15:32:13 2003
@@ -15,7 +15,7 @@
 
 from ZODB.Transaction import Transaction
 from ZODB.POSException import ConflictError, UndoError
-from Persistence import Persistent
+from persistent import Persistent
 
 from ZODB.tests.StorageTestBase import zodb_unpickle, zodb_pickle
 
@@ -94,9 +94,12 @@
         # pickle is to commit two different transactions relative to
         # revid1 that add two to _value.
         revid2 = self._dostoreNP(oid, revid=revid1, data=zodb_pickle(obj))
-        self.assertRaises(ConflictError,
-                          self._dostoreNP,
-                          oid, revid=revid1, data=zodb_pickle(obj))
+        try:
+            self._dostoreNP(oid, revid=revid1, data=zodb_pickle(obj))
+        except ConflictError, err:
+            self.assert_("PCounter2" in str(err))
+        else:
+            self.fail("Expected ConflictError")
 
     def checkZClassesArentResolved(self):
         from ZODB.ConflictResolution import bad_class


=== ZODB3/ZODB/tests/HistoryStorage.py 1.11 => 1.11.10.1 ===
--- ZODB3/ZODB/tests/HistoryStorage.py:1.11	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/HistoryStorage.py	Tue Nov 25 15:32:13 2003
@@ -132,7 +132,7 @@
         # Now commit the version
         t = Transaction()
         self._storage.tpc_begin(t)
-        oids = self._storage.commitVersion(version, '', t)
+        self._storage.commitVersion(version, '', t)
         self._storage.tpc_vote(t)
         self._storage.tpc_finish(t)
         # After consultation with Jim, we agreed that the semantics of
@@ -192,7 +192,7 @@
         # Now commit the version
         t = Transaction()
         self._storage.tpc_begin(t)
-        oids = self._storage.abortVersion(version, t)
+        self._storage.abortVersion(version, t)
         self._storage.tpc_vote(t)
         self._storage.tpc_finish(t)
         # After consultation with Jim, we agreed that the semantics of


=== ZODB3/ZODB/tests/MTStorage.py 1.11 => 1.11.10.1 ===
--- ZODB3/ZODB/tests/MTStorage.py:1.11	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/MTStorage.py	Tue Nov 25 15:32:13 2003
@@ -4,7 +4,7 @@
 import time
 
 import ZODB
-from PersistentMapping import PersistentMapping
+from persistent.mapping import PersistentMapping
 
 from ZODB.tests.StorageTestBase \
      import StorageTestBase, zodb_pickle, zodb_unpickle, handle_serials


=== ZODB3/ZODB/tests/MinPO.py 1.4 => 1.4.10.1 ===
--- ZODB3/ZODB/tests/MinPO.py:1.4	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/MinPO.py	Tue Nov 25 15:32:13 2003
@@ -13,7 +13,7 @@
 ##############################################################################
 """A minimal persistent object to use for tests"""
 
-from Persistence import Persistent
+from persistent import Persistent
 
 class MinPO(Persistent):
     def __init__(self, value=None):


=== ZODB3/ZODB/tests/PackableStorage.py 1.23 => 1.23.8.1 ===
--- ZODB3/ZODB/tests/PackableStorage.py:1.23	Sat Oct  4 23:03:58 2003
+++ ZODB3/ZODB/tests/PackableStorage.py	Tue Nov 25 15:32:13 2003
@@ -29,7 +29,7 @@
 import time
 
 from ZODB import DB
-from Persistence import Persistent
+from persistent import Persistent
 from ZODB.referencesf import referencesf
 from ZODB.tests.MinPO import MinPO
 from ZODB.tests.StorageTestBase import snooze
@@ -128,11 +128,11 @@
         try:
             self._storage.load(ZERO, '')
         except KeyError:
-            import PersistentMapping
+            from persistent import mapping
             from ZODB.Transaction import Transaction
             file = StringIO()
             p = cPickle.Pickler(file, 1)
-            p.dump((PersistentMapping.PersistentMapping, None))
+            p.dump((mapping.PersistentMapping, None))
             p.dump({'_container': {}})
             t=Transaction()
             t.description='initial database creation'
@@ -438,8 +438,6 @@
 
     def checkPackUndoLog(self):
         self._initroot()
-        eq = self.assertEqual
-        raises = self.assertRaises
         # Create a `persistent' object
         obj = self._newobj()
         oid = obj.getoid()
@@ -450,9 +448,9 @@
         snooze()
         packtime = time.time()
         snooze()
-        revid2 = self._dostoreNP(oid, revid=revid1, data=pickle.dumps(obj))
+        self._dostoreNP(oid, revid=revid1, data=pickle.dumps(obj))
         # Now pack the first transaction
-        self.assertEqual(3,len(self._storage.undoLog()))
+        self.assertEqual(3, len(self._storage.undoLog()))
         self._storage.pack(packtime, referencesf)
         # The undo log contains only the most resent transaction
         self.assertEqual(1,len(self._storage.undoLog()))
@@ -489,12 +487,12 @@
         revid13 = self._dostoreNP(oid1, revid=revid11,
                                   data=pickle.dumps(obj1), description="1-3")
         obj1.value = 4
-        revid14 = self._dostoreNP(oid1, revid=revid13,
-                                  data=pickle.dumps(obj1), description="1-4")
+        self._dostoreNP(oid1, revid=revid13,
+                        data=pickle.dumps(obj1), description="1-4")
         # Commit one revision of the second object
         obj2.value = 5
-        revid25 = self._dostoreNP(oid2, revid=revid22,
-                                  data=pickle.dumps(obj2), description="2-5")
+        self._dostoreNP(oid2, revid=revid22,
+                        data=pickle.dumps(obj2), description="2-5")
         # Now pack
         self.assertEqual(6,len(self._storage.undoLog()))
         print '\ninitial undoLog was'


=== ZODB3/ZODB/tests/StorageTestBase.py 1.29 => 1.29.10.1 ===
--- ZODB3/ZODB/tests/StorageTestBase.py:1.29	Thu Oct  2 20:34:32 2003
+++ ZODB3/ZODB/tests/StorageTestBase.py	Tue Nov 25 15:32:13 2003
@@ -21,7 +21,6 @@
 
 import errno
 import os
-import pickle
 import string
 import sys
 import time
@@ -46,11 +45,18 @@
     while now == time.time():
         time.sleep(0.1)
 
+def _persistent_id(obj):
+    oid = getattr(obj, "_p_oid", None)
+    if getattr(oid, "__get__", None) is not None:
+        return None
+    else:
+        return oid
+
 def zodb_pickle(obj):
     """Create a pickle in the format expected by ZODB."""
     f = StringIO()
     p = Pickler(f, 1)
-    p.persistent_id = lambda obj: getattr(obj, '_p_oid', None)
+    p.persistent_id = _persistent_id
     klass = obj.__class__
     assert not hasattr(obj, '__getinitargs__'), "not ready for constructors"
     args = None
@@ -131,7 +137,7 @@
     return handle_all_serials(oid, *args)[oid]
 
 def import_helper(name):
-    mod = __import__(name)
+    __import__(name)
     return sys.modules[name]
 
 def removefs(base):


=== ZODB3/ZODB/tests/TransactionalUndoStorage.py 1.34 => 1.34.4.1 ===
--- ZODB3/ZODB/tests/TransactionalUndoStorage.py:1.34	Mon Nov  3 13:56:29 2003
+++ ZODB3/ZODB/tests/TransactionalUndoStorage.py	Tue Nov 25 15:32:13 2003
@@ -24,7 +24,7 @@
 from ZODB.utils import u64, p64
 from ZODB import DB
 
-from Persistence import Persistent
+from persistent import Persistent
 from ZODB.tests.MinPO import MinPO
 from ZODB.tests.StorageTestBase import zodb_pickle, zodb_unpickle
 
@@ -98,6 +98,15 @@
             for rec in txn:
                 pass
 
+    def undo(self, tid, note):
+        t = Transaction()
+        t.note(note)
+        self._storage.tpc_begin(t)
+        oids = self._storage.transactionalUndo(tid, t)
+        self._storage.tpc_vote(t)
+        self._storage.tpc_finish(t)
+        return oids
+
     def checkSimpleTransactionalUndo(self):
         eq = self.assertEqual
         oid = self._storage.new_oid()
@@ -108,12 +117,7 @@
         info = self._storage.undoInfo()
         tid = info[0]['id']
         # Now start an undo transaction
-        t = Transaction()
-        t.note('undo1')
-        self._storage.tpc_begin(t)
-        oids = self._storage.transactionalUndo(tid, t)
-        self._storage.tpc_vote(t)
-        self._storage.tpc_finish(t)
+        oids = self.undo(tid, "undo1")
         eq(len(oids), 1)
         eq(oids[0], oid)
         data, revid = self._storage.load(oid, '')
@@ -121,12 +125,7 @@
         # Do another one
         info = self._storage.undoInfo()
         tid = info[2]['id']
-        t = Transaction()
-        t.note('undo2')
-        self._storage.tpc_begin(t)
-        oids = self._storage.transactionalUndo(tid, t)
-        self._storage.tpc_vote(t)
-        self._storage.tpc_finish(t)
+        oids = self.undo(tid, "undo2")
         eq(len(oids), 1)
         eq(oids[0], oid)
         data, revid = self._storage.load(oid, '')
@@ -134,12 +133,7 @@
         # Try to undo the first record
         info = self._storage.undoInfo()
         tid = info[4]['id']
-        t = Transaction()
-        t.note('undo3')
-        self._storage.tpc_begin(t)
-        oids = self._storage.transactionalUndo(tid, t)
-        self._storage.tpc_vote(t)
-        self._storage.tpc_finish(t)
+        oids = self.undo(tid, "undo3")
         eq(len(oids), 1)
         eq(oids[0], oid)
         # This should fail since we've undone the object's creation
@@ -148,11 +142,7 @@
         # And now let's try to redo the object's creation
         info = self._storage.undoInfo()
         tid = info[0]['id']
-        t = Transaction()
-        self._storage.tpc_begin(t)
-        oids = self._storage.transactionalUndo(tid, t)
-        self._storage.tpc_vote(t)
-        self._storage.tpc_finish(t)
+        oids = self.undo(tid, "undo4")
         eq(len(oids), 1)
         eq(oids[0], oid)
         data, revid = self._storage.load(oid, '')
@@ -162,14 +152,14 @@
     def checkCreationUndoneGetSerial(self):
         # create an object
         oid = self._storage.new_oid()
-        revid = self._dostore(oid, data=MinPO(23))
+        self._dostore(oid, data=MinPO(23))
         # undo its creation
         info = self._storage.undoInfo()
         tid = info[0]['id']
         t = Transaction()
         t.note('undo1')
         self._storage.tpc_begin(t)
-        oids = self._storage.transactionalUndo(tid, t)
+        self._storage.transactionalUndo(tid, t)
         self._storage.tpc_vote(t)
         self._storage.tpc_finish(t)
         # Check that calling getSerial on an uncreated object raises a KeyError
@@ -501,7 +491,7 @@
         packtime = time.time()
         snooze()                # time.time() now distinct from packtime
         revid2 = self._dostore(oid, revid=revid1, data=MinPO(52))
-        revid3 = self._dostore(oid, revid=revid2, data=MinPO(53))
+        self._dostore(oid, revid=revid2, data=MinPO(53))
         # Now get the undo log
         info = self._storage.undoInfo()
         eq(len(info), 3)
@@ -669,7 +659,10 @@
         for t in packtimes:
             self._storage.pack(t, referencesf)
             cn.sync()
-            cn._cache.clear()
+
+            # XXX Is _cache supposed to have a clear() method, or not?
+            # cn._cache.clear()
+
             # The last undo set the value to 3 and pack should
             # never change that.
             self.assertEqual(rt["test"].value, 3)


=== ZODB3/ZODB/tests/TransactionalUndoVersionStorage.py 1.13 => 1.13.4.1 ===
--- ZODB3/ZODB/tests/TransactionalUndoVersionStorage.py:1.13	Mon Nov  3 13:56:29 2003
+++ ZODB3/ZODB/tests/TransactionalUndoVersionStorage.py	Tue Nov 25 15:32:13 2003
@@ -123,9 +123,9 @@
         version = 'version'
         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._x_dostore(oid1, data=MinPO(2), revid=revid2,
-                               version=version, description='version2')
+                                 version=version, description='version1')
+        self._x_dostore(oid1, data=MinPO(2), revid=revid2,
+                        version=version, description='version2')
         self._x_dostore(description='create2')
 
         t = Transaction()
@@ -170,9 +170,9 @@
         version = 'version'
         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._x_dostore(oid1, data=MinPO(2), revid=revid2,
-                               version=version, description='version2')
+                                 version=version, description='version1')
+        self._x_dostore(oid1, data=MinPO(2), revid=revid2,
+                        version=version, description='version2')
         self._x_dostore(description='create2')
 
         t = Transaction()


=== ZODB3/ZODB/tests/VersionStorage.py 1.25 => 1.25.10.1 ===
--- ZODB3/ZODB/tests/VersionStorage.py:1.25	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/VersionStorage.py	Tue Nov 25 15:32:13 2003
@@ -165,7 +165,7 @@
         oid = self._storage.new_oid()
         revid = self._dostore(oid, data=MinPO(49))
         revid = self._dostore(oid, revid=revid, data=MinPO(50))
-        nvrevid = revid = self._dostore(oid, revid=revid, data=MinPO(51))
+        revid = self._dostore(oid, revid=revid, data=MinPO(51))
         # Now do some stores in a version
         revid = self._dostore(oid, revid=revid, data=MinPO(52),
                               version=version)
@@ -240,7 +240,6 @@
             self._storage.tpc_abort(t)
 
     def checkNewSerialOnCommitVersionToVersion(self):
-        eq = self.assertEqual
         oid, version = self._setup_version()
         data, vserial = self._storage.load(oid, version)
         data, nserial = self._storage.load(oid, '')


=== ZODB3/ZODB/tests/dangle.py 1.2 => 1.2.10.1 ===
--- ZODB3/ZODB/tests/dangle.py:1.2	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/dangle.py	Tue Nov 25 15:32:13 2003
@@ -21,7 +21,7 @@
 from ZODB.FileStorage import FileStorage
 from ZODB import DB
 
-from Persistence import Persistent
+from persistent import Persistent
 
 class P(Persistent):
     pass


=== ZODB3/ZODB/tests/speed.py 1.4 => 1.4.126.1 ===
--- ZODB3/ZODB/tests/speed.py:1.4	Wed Aug 14 18:07:09 2002
+++ ZODB3/ZODB/tests/speed.py	Tue Nov 25 15:32:13 2003
@@ -39,9 +39,9 @@
 sys.path.insert(0, os.getcwd())
 
 import ZODB, ZODB.FileStorage
-import Persistence
+import persistent
 
-class P(Persistence.Persistent): pass
+class P(persistent.Persistent): pass
 
 def main(args):
 


=== ZODB3/ZODB/tests/testCache.py 1.16 => 1.16.4.1 ===
--- ZODB3/ZODB/tests/testCache.py:1.16	Mon Nov  3 13:56:29 2003
+++ ZODB3/ZODB/tests/testCache.py	Tue Nov 25 15:32:13 2003
@@ -24,13 +24,13 @@
 
 import ZODB
 import ZODB.MappingStorage
-from ZODB.cPickleCache import PickleCache
 from ZODB.POSException import ConflictError
-from ZODB.PersistentMapping import PersistentMapping
+from persistent.cPickleCache import PickleCache
+from persistent.mapping import PersistentMapping
 from ZODB.tests.MinPO import MinPO
 from ZODB.utils import p64
 
-from Persistence import Persistent
+from persistent import Persistent
 
 class CacheTestBase(unittest.TestCase):
 


=== ZODB3/ZODB/tests/testPersistentList.py 1.4 => 1.4.10.1 ===
--- ZODB3/ZODB/tests/testPersistentList.py:1.4	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/testPersistentList.py	Tue Nov 25 15:32:13 2003
@@ -15,7 +15,7 @@
 """
 
 import unittest
-from ZODB.PersistentList import PersistentList
+from persistent.list import PersistentList
 
 l0 = []
 l1 = [0]


=== ZODB3/ZODB/tests/testPersistentMapping.py 1.6 => 1.6.10.1 ===
--- ZODB3/ZODB/tests/testPersistentMapping.py:1.6	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/testPersistentMapping.py	Tue Nov 25 15:32:13 2003
@@ -58,7 +58,7 @@
         r = db.open().root()
         r[1] = 1
         r[2] = 2
-##        r[3] = r
+        r[3] = r
         get_transaction().commit()
         # MappingStorage stores serialno + pickle in its _index.
         root_pickle = s._index['\000' * 8][8:]
@@ -67,7 +67,7 @@
         u = cPickle.Unpickler(f)
         klass_info = u.load()
         klass = find_global(*klass_info[0])
-        inst = klass()
+        inst = klass.__new__(klass)
         state = u.load()
         inst.__setstate__(state)
 
@@ -78,7 +78,7 @@
     """Helper for this test suite to get special PersistentMapping"""
 
     if classname == "PersistentMapping":
-        class PersistentMapping:
+        class PersistentMapping(object):
             def __setstate__(self, state):
                 self.__dict__.update(state)
         return PersistentMapping
@@ -88,9 +88,8 @@
         return getattr(mod, classname)
 
 def test_suite():
+    return None
     return unittest.makeSuite(PMTests, 'check')
 
 if __name__ == "__main__":
-    loader = unittest.TestLoader()
-    loader.testMethodPrefix = "check"
-    unittest.main(testLoader=loader)
+    unittest.main()


=== ZODB3/ZODB/tests/testRecover.py 1.4 => 1.4.10.1 ===
--- ZODB3/ZODB/tests/testRecover.py:1.4	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/testRecover.py	Tue Nov 25 15:32:13 2003
@@ -23,9 +23,10 @@
 
 import ZODB
 from ZODB.FileStorage import FileStorage
-from ZODB.PersistentMapping import PersistentMapping
 from ZODB.fsrecover import recover
 from ZODB.tests.StorageTestBase import removefs
+
+from persistent.mapping import PersistentMapping
 
 from ZODB.fsdump import Dumper
 


=== ZODB3/ZODB/tests/testTimeStamp.py 1.5 => 1.5.10.1 ===
--- ZODB3/ZODB/tests/testTimeStamp.py:1.5	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/testTimeStamp.py	Tue Nov 25 15:32:13 2003
@@ -16,7 +16,7 @@
 import time
 import unittest
 
-from ZODB.TimeStamp import TimeStamp
+from persistent.TimeStamp import TimeStamp
 
 EPSILON = 0.000001
 
@@ -106,7 +106,6 @@
         self.assertEquals(t.hour(), 10)
         self.assertEquals(t.minute(), 48)
         self.assertEquals(round(t.second()), 5)
-        self.assertEquals(t.second(), t.seconds()) # Alias
         self.assertEquals(t.timeTime(), 1011782885)
         t1 = TimeStamp(2002, 1, 23, 10, 48, 10)
         self.assertEquals(str(t1), '2002-01-23 10:48:10.000000')


=== ZODB3/ZODB/tests/testTransaction.py 1.15 => 1.15.2.1 ===


=== ZODB3/ZODB/tests/testZODB.py 1.17 => 1.17.4.1 ===
--- ZODB3/ZODB/tests/testZODB.py:1.17	Mon Nov  3 13:56:29 2003
+++ ZODB3/ZODB/tests/testZODB.py	Tue Nov 25 15:32:13 2003
@@ -15,10 +15,10 @@
 
 import ZODB
 import ZODB.FileStorage
-from ZODB.PersistentMapping import PersistentMapping
 from ZODB.POSException import ReadConflictError, ConflictError
 from ZODB.tests.StorageTestBase import removefs
-from Persistence import Persistent
+from persistent import Persistent
+from persistent.mapping import PersistentMapping
 
 class P(Persistent):
     pass




More information about the Zodb-checkins mailing list