[Zope3-checkins] CVS: Zope3/lib/python/ZODB/tests - PackableStorage.py:1.18 StorageTestBase.py:1.20 testZODB.py:1.11
Jeremy Hylton
jeremy@zope.com
Tue, 26 Nov 2002 12:41:22 -0500
Update of /cvs-repository/Zope3/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv23161/ZODB/tests
Modified Files:
PackableStorage.py StorageTestBase.py testZODB.py
Log Message:
Big set of interlocking changes.
Implement much more of pickling functionality in Serialize module.
Rename pickler and unpickler classes to ObjectWriter and ObjectReader,
since they use pickles internally but aren't themselves picklers.
Connection now uses an ObjectWriter instead of calling pickle
directly.
Remove second argument from pack. Call the findrefs() function from
Serialize directly rather than passing it around everywhere. There's
far more work to be done to make serialization pluggable and this only
made matters more complicated.
Change __name__ attribute of storages to _name, since it __ names
suggested that they are reserved or special and this attribute isn't.
XXX Make minimal changes to ExportImport, but it should be using
Serialize rather than using a pickler directly.
Remove new_persistent_id() factory function. persistent_id() is now a
method on the ObjectWriter.
Remove __len__() and getSize() methods from storage API, at least for
now.
=== Zope3/lib/python/ZODB/tests/PackableStorage.py 1.17 => 1.18 ===
--- Zope3/lib/python/ZODB/tests/PackableStorage.py:1.17 Thu Oct 3 15:44:25 2002
+++ Zope3/lib/python/ZODB/tests/PackableStorage.py Tue Nov 26 12:41:21 2002
@@ -133,15 +133,15 @@
self._storage.tpc_finish(t)
def checkPackEmptyStorage(self):
- self._storage.pack(time.time(), referencesf)
+ self._storage.pack(time.time())
def checkPackTomorrow(self):
self._initroot()
- self._storage.pack(time.time() + 10000, referencesf)
+ self._storage.pack(time.time() + 100000)
def checkPackYesterday(self):
self._initroot()
- self._storage.pack(time.time() - 10000, referencesf)
+ self._storage.pack(time.time() - 100000)
def checkPackAllRevisions(self):
self._initroot()
@@ -173,7 +173,7 @@
# Now pack all transactions; need to sleep a second to make
# sure that the pack time is greater than the last commit time.
time.sleep(1)
- self._storage.pack(time.time(), referencesf)
+ self._storage.pack(time.time())
# All revisions of the object should be gone, since there is no
# reference from the root object to this object.
raises(KeyError, self._storage.loadSerial, oid, revid1)
@@ -224,7 +224,7 @@
# Now pack just revisions 1 and 2. The object's current revision
# should stay alive because it's pointed to by the root.
time.sleep(1)
- self._storage.pack(time.time(), referencesf)
+ self._storage.pack(time.time())
# Make sure the revisions are gone, but that object zero and revision
# 3 are still there and correct
data, revid = self._storage.load(ZERO, '')
@@ -301,7 +301,7 @@
# revision should stay alive because it's pointed to by the root, as
# should Object2's current revision.
time.sleep(1)
- self._storage.pack(time.time(), referencesf)
+ self._storage.pack(time.time())
# Make sure the revisions are gone, but that object zero, object2, and
# revision 3 of object1 are still there and correct.
data, revid = self._storage.load(ZERO, '')
=== Zope3/lib/python/ZODB/tests/StorageTestBase.py 1.19 => 1.20 ===
--- Zope3/lib/python/ZODB/tests/StorageTestBase.py:1.19 Mon Nov 25 14:54:50 2002
+++ Zope3/lib/python/ZODB/tests/StorageTestBase.py Tue Nov 26 12:41:21 2002
@@ -29,7 +29,7 @@
from cPickle import Pickler, Unpickler
from cStringIO import StringIO
-from ZODB.Serialize import ConnectionUnpickler
+from ZODB.Serialize import ConnectionObjectReader
from ZODB.ZTransaction import Transaction
from ZODB.tests.MinPO import MinPO
@@ -50,7 +50,7 @@
def zodb_unpickle(data):
"""Unpickle an object stored using the format expected by ZODB."""
- u = ConnectionUnpickler(None, {})
+ u = ConnectionObjectReader(None, {})
return u.getObject(data)
def handle_all_serials(oid, *args):
=== Zope3/lib/python/ZODB/tests/testZODB.py 1.10 => 1.11 ===
--- Zope3/lib/python/ZODB/tests/testZODB.py:1.10 Thu Oct 17 09:29:35 2002
+++ Zope3/lib/python/ZODB/tests/testZODB.py Tue Nov 26 12:41:21 2002
@@ -31,7 +31,6 @@
ob = root['test']
self.assert_(len(ob) > 10, 'Insufficient test data')
try:
- import tempfile
f = tempfile.TemporaryFile()
ob._p_jar.exportFile(ob._p_oid, f)
self.assert_(f.tell() > 0, 'Did not export correctly')
@@ -44,7 +43,6 @@
else:
get_transaction().commit()
except Exception, err:
- print err
get_transaction().abort()
raise
finally: