[Zodb-checkins] CVS: Zope/lib/python/ZODB/tests - BasicStorage.py:1.19 ConflictResolution.py:1.8 Corruption.py:1.6 HistoryStorage.py:1.7 IteratorStorage.py:1.12 MTStorage.py:1.4 PackableStorage.py:1.13 PersistentStorage.py:1.2 ReadOnlyStorage.py:1.3 RevisionStorage.py:1.2 StorageTestBase.py:1.17 Synchronization.py:1.6 TransactionalUndoStorage.py:1.21 TransactionalUndoVersionStorage.py:1.8 VersionStorage.py:1.14 speed.py:1.4 testActivityMonitor.py:1.3 testCache.py:1.9 testDB.py:1.2 testDemoStorage.py:1.5 testFileStorage.py:1.19 testMappingStorage.py:1.4 testPersistentMapping.py:1.4 testTransaction.py:1.10 testUtils.py:1.2 testZODB.py:1.4 testfsIndex.py:1.5
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 18:07:11 -0400
Update of /cvs-repository/Zope/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv20265/tests
Modified Files:
BasicStorage.py ConflictResolution.py Corruption.py
HistoryStorage.py IteratorStorage.py MTStorage.py
PackableStorage.py PersistentStorage.py ReadOnlyStorage.py
RevisionStorage.py StorageTestBase.py Synchronization.py
TransactionalUndoStorage.py TransactionalUndoVersionStorage.py
VersionStorage.py speed.py testActivityMonitor.py testCache.py
testDB.py testDemoStorage.py testFileStorage.py
testMappingStorage.py testPersistentMapping.py
testTransaction.py testUtils.py testZODB.py testfsIndex.py
Log Message:
Clean up indentation and trailing whitespace.
=== Zope/lib/python/ZODB/tests/BasicStorage.py 1.18 => 1.19 ===
--- Zope/lib/python/ZODB/tests/BasicStorage.py:1.18 Thu May 16 16:02:37 2002
+++ Zope/lib/python/ZODB/tests/BasicStorage.py Wed Aug 14 18:07:09 2002
@@ -16,7 +16,7 @@
ZERO = '\0'*8
-
+
class BasicStorage:
def checkBasics(self):
t = Transaction()
=== Zope/lib/python/ZODB/tests/ConflictResolution.py 1.7 => 1.8 ===
--- Zope/lib/python/ZODB/tests/ConflictResolution.py:1.7 Tue Jan 22 11:42:41 2002
+++ Zope/lib/python/ZODB/tests/ConflictResolution.py Wed Aug 14 18:07:09 2002
@@ -59,7 +59,7 @@
obj.inc()
# The effect of committing two transactions with the same
# pickle is to commit two different transactions relative to
- # revid1 that add two to _value.
+ # revid1 that add two to _value.
revid2 = self._dostoreNP(oid, revid=revid1, data=zodb_pickle(obj))
revid3 = self._dostoreNP(oid, revid=revid1, data=zodb_pickle(obj))
@@ -79,7 +79,7 @@
obj.inc()
# The effect of committing two transactions with the same
# pickle is to commit two different transactions relative to
- # revid1 that add two to _value.
+ # revid1 that add two to _value.
revid2 = self._dostoreNP(oid, revid=revid1, data=zodb_pickle(obj))
self.assertRaises(ConflictError,
self._dostoreNP,
@@ -89,7 +89,7 @@
from ZODB.ConflictResolution import bad_class
dummy_class_tuple = ('*foobar', ())
assert bad_class(dummy_class_tuple) == 1
-
+
def checkBuggyResolve1(self):
obj = PCounter3()
obj.inc()
@@ -102,7 +102,7 @@
obj.inc()
# The effect of committing two transactions with the same
# pickle is to commit two different transactions relative to
- # revid1 that add two to _value.
+ # revid1 that add two to _value.
revid2 = self._dostoreNP(oid, revid=revid1, data=zodb_pickle(obj))
self.assertRaises(AttributeError,
self._dostoreNP,
@@ -120,7 +120,7 @@
obj.inc()
# The effect of committing two transactions with the same
# pickle is to commit two different transactions relative to
- # revid1 that add two to _value.
+ # revid1 that add two to _value.
revid2 = self._dostoreNP(oid, revid=revid1, data=zodb_pickle(obj))
self.assertRaises(TypeError,
self._dostoreNP,
@@ -132,7 +132,7 @@
# This test is based on checkNotUndoable in the
# TransactionalUndoStorage test suite. Except here, conflict
# resolution should allow us to undo the transaction anyway.
-
+
obj = PCounter()
obj.inc()
oid = self._storage.new_oid()
@@ -153,7 +153,7 @@
# This test is based on checkNotUndoable in the
# TransactionalUndoStorage test suite. Except here, conflict
# resolution should allow us to undo the transaction anyway.
-
+
obj = PCounter2()
obj.inc()
oid = self._storage.new_oid()
@@ -170,4 +170,3 @@
self.assertRaises(UndoError, self._storage.transactionalUndo,
tid, t)
self._storage.tpc_abort(t)
-
=== Zope/lib/python/ZODB/tests/Corruption.py 1.5 => 1.6 ===
--- Zope/lib/python/ZODB/tests/Corruption.py:1.5 Thu Aug 8 14:25:10 2002
+++ Zope/lib/python/ZODB/tests/Corruption.py Wed Aug 14 18:07:09 2002
@@ -35,7 +35,7 @@
def checkTruncatedIndex(self):
oids = self._do_stores()
self._close()
-
+
# truncation the index file
path = self.path + '.index'
self.failUnless(os.path.exists(path))
@@ -52,7 +52,7 @@
def checkCorruptedIndex(self):
oids = self._do_stores()
self._close()
-
+
# truncation the index file
path = self.path + '.index'
self.failUnless(os.path.exists(path))
=== Zope/lib/python/ZODB/tests/HistoryStorage.py 1.6 => 1.7 ===
--- Zope/lib/python/ZODB/tests/HistoryStorage.py:1.6 Tue Jan 22 11:42:41 2002
+++ Zope/lib/python/ZODB/tests/HistoryStorage.py Wed Aug 14 18:07:09 2002
@@ -9,7 +9,7 @@
from ZODB.tests.StorageTestBase import zodb_unpickle
-
+
class HistoryStorage:
def checkSimpleHistory(self):
eq = self.assertEqual
=== Zope/lib/python/ZODB/tests/IteratorStorage.py 1.11 => 1.12 ===
--- Zope/lib/python/ZODB/tests/IteratorStorage.py:1.11 Fri Jan 25 18:01:58 2002
+++ Zope/lib/python/ZODB/tests/IteratorStorage.py Wed Aug 14 18:07:09 2002
@@ -9,7 +9,7 @@
from ZODB.utils import U64, p64
from ZODB.Transaction import Transaction
-
+
class IteratorCompare:
def iter_verify(self, txniter, revids, val0):
=== Zope/lib/python/ZODB/tests/MTStorage.py 1.3 => 1.4 ===
--- Zope/lib/python/ZODB/tests/MTStorage.py:1.3 Tue Aug 6 11:05:25 2002
+++ Zope/lib/python/ZODB/tests/MTStorage.py Wed Aug 14 18:07:09 2002
@@ -173,7 +173,7 @@
t.join(10)
for t in threads:
self.failIf(t.isAlive())
-
+
def check2ZODBThreads(self):
db = ZODB.DB(self._storage)
self._checkNThreads(2, ZODBClientThread, db, self)
@@ -184,10 +184,9 @@
def check2StorageThreads(self):
self._checkNThreads(2, StorageClientThread, self._storage, self)
-
+
def check7StorageThreads(self):
self._checkNThreads(7, StorageClientThread, self._storage, self)
def check4ExtStorageThread(self):
self._checkNThreads(4, ExtStorageClientThread, self._storage, self)
-
=== Zope/lib/python/ZODB/tests/PackableStorage.py 1.12 => 1.13 ===
--- Zope/lib/python/ZODB/tests/PackableStorage.py:1.12 Fri Nov 2 16:51:39 2001
+++ Zope/lib/python/ZODB/tests/PackableStorage.py Wed Aug 14 18:07:09 2002
@@ -18,7 +18,7 @@
ZERO = '\0'*8
-
+
# This class is for the root object. It must not contain a getoid() method
# (really, attribute). The persistent pickling machinery -- in the dumps()
# function below -- will pickle Root objects as normal, but any attributes
@@ -64,7 +64,7 @@
return s.getvalue()
-
+
class PackableStorageBase:
# We keep a cache of object ids to instances so that the unpickler can
# easily return any persistent object.
@@ -100,7 +100,7 @@
return loads
-
+
class PackableStorage(PackableStorageBase):
def _initroot(self):
try:
@@ -125,11 +125,11 @@
def checkPackTomorrow(self):
self._initroot()
self._storage.pack(time.time() + 10000, referencesf)
-
+
def checkPackYesterday(self):
self._initroot()
self._storage.pack(time.time() - 10000, referencesf)
-
+
def checkPackAllRevisions(self):
self._initroot()
eq = self.assertEqual
=== Zope/lib/python/ZODB/tests/PersistentStorage.py 1.1 => 1.2 ===
--- Zope/lib/python/ZODB/tests/PersistentStorage.py:1.1 Fri Oct 5 13:44:27 2001
+++ Zope/lib/python/ZODB/tests/PersistentStorage.py Wed Aug 14 18:07:09 2002
@@ -4,7 +4,7 @@
def checkUpdatesPersist(self):
oids = []
-
+
def new_oid_wrapper(l=oids, new_oid=self._storage.new_oid):
oid = new_oid()
l.append(oid)
@@ -31,7 +31,7 @@
if ver:
p, s = self._storage.load(oid, ver)
objects.append((oid, ver, p, s))
-
+
self._storage.close()
self.open()
=== Zope/lib/python/ZODB/tests/ReadOnlyStorage.py 1.2 => 1.3 ===
--- Zope/lib/python/ZODB/tests/ReadOnlyStorage.py:1.2 Mon Jan 21 11:45:41 2002
+++ Zope/lib/python/ZODB/tests/ReadOnlyStorage.py Wed Aug 14 18:07:09 2002
@@ -38,7 +38,7 @@
self.assertRaises(ReadOnlyError, self._storage.abortVersion,
'', t)
self._storage.tpc_abort(t)
-
+
t = Transaction()
self._storage.tpc_begin(t)
self.assertRaises(ReadOnlyError, self._storage.commitVersion,
@@ -57,5 +57,3 @@
self.assertRaises(ReadOnlyError, self._storage.transactionalUndo,
'\000' * 8, t)
self._storage.tpc_abort(t)
-
-
=== Zope/lib/python/ZODB/tests/RevisionStorage.py 1.1 => 1.2 ===
--- Zope/lib/python/ZODB/tests/RevisionStorage.py:1.1 Thu Oct 4 18:37:03 2001
+++ Zope/lib/python/ZODB/tests/RevisionStorage.py Wed Aug 14 18:07:09 2002
@@ -6,7 +6,7 @@
ZERO = '\0'*8
class RevisionStorage:
-
+
def checkLoadSerial(self):
oid = self._storage.new_oid()
revid = ZERO
@@ -18,4 +18,3 @@
for revid, value in revisions.items():
data = self._storage.loadSerial(oid, revid)
self.assertEqual(zodb_unpickle(data), value)
-
=== Zope/lib/python/ZODB/tests/StorageTestBase.py 1.16 => 1.17 ===
--- Zope/lib/python/ZODB/tests/StorageTestBase.py:1.16 Thu Aug 8 14:25:10 2002
+++ Zope/lib/python/ZODB/tests/StorageTestBase.py Wed Aug 14 18:07:09 2002
@@ -116,13 +116,13 @@
except os.error, err:
if err[0] != errno.ENOENT:
raise
-
-
+
+
class StorageTestBase(unittest.TestCase):
# XXX It would be simpler if concrete tests didn't need to extend
# setUp() and tearDown().
-
+
def setUp(self):
# You need to override this with a setUp that creates self._storage
self._storage = None
@@ -139,12 +139,12 @@
def _dostore(self, oid=None, revid=None, data=None, version=None,
already_pickled=0, user=None, description=None):
"""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:
@@ -177,7 +177,7 @@
self._storage.tpc_abort(t)
raise
return revid
-
+
def _dostoreNP(self, oid=None, revid=None, data=None, version=None,
user=None, description=None):
return self._dostore(oid, revid, data, version, already_pickled=1)
=== Zope/lib/python/ZODB/tests/Synchronization.py 1.5 => 1.6 ===
--- Zope/lib/python/ZODB/tests/Synchronization.py:1.5 Sat Jan 26 15:28:45 2002
+++ Zope/lib/python/ZODB/tests/Synchronization.py Wed Aug 14 18:07:09 2002
@@ -61,7 +61,7 @@
## def verifyCommitting(self, callable, *args):
## self.assertRaises(StorageTransactionError, callable *args)
-
+
def verifyNotCommitting(self, callable, *args):
args = (StorageTransactionError, callable) + args
apply(self.assertRaises, args)
@@ -92,17 +92,17 @@
def checkStoreNotCommitting(self):
self.verifyNotCommitting(self._storage.store,
OID, SERIALNO, "", "", Transaction())
-
+
def checkStoreWrongTrans(self):
self.verifyWrongTrans(self._storage.store,
OID, SERIALNO, "", "", Transaction())
## def checkNewOidNotCommitting(self):
## self.verifyNotCommitting(self._storage.new_oid)
-
+
## def checkNewOidWrongTrans(self):
## self.verifyWrongTrans(self._storage.new_oid)
-
+
def checkAbortNotCommitting(self):
self._storage.tpc_abort(Transaction())
@@ -123,7 +123,7 @@
self._storage.tpc_begin(t)
self._storage.tpc_finish(Transaction())
self._storage.tpc_abort(t)
-
+
def checkBeginCommitting(self):
t = Transaction()
self._storage.tpc_begin(t)
=== Zope/lib/python/ZODB/tests/TransactionalUndoStorage.py 1.20 => 1.21 ===
--- Zope/lib/python/ZODB/tests/TransactionalUndoStorage.py:1.20 Fri May 24 14:59:05 2002
+++ Zope/lib/python/ZODB/tests/TransactionalUndoStorage.py Wed Aug 14 18:07:09 2002
@@ -51,7 +51,7 @@
for oid in newrevs.keys():
newrevs[oid] = self._transaction_newserial(oid)
return newrevs
-
+
def checkSimpleTransactionalUndo(self):
eq = self.assertEqual
oid = self._storage.new_oid()
@@ -366,7 +366,7 @@
eq(zodb_unpickle(data), MinPO(33))
data, revid2 = self._storage.load(oid2, '')
eq(zodb_unpickle(data), MinPO(54))
-
+
def checkNotUndoable(self):
eq = self.assertEqual
=== Zope/lib/python/ZODB/tests/TransactionalUndoVersionStorage.py 1.7 => 1.8 ===
--- Zope/lib/python/ZODB/tests/TransactionalUndoVersionStorage.py:1.7 Tue Jun 18 12:55:51 2002
+++ Zope/lib/python/ZODB/tests/TransactionalUndoVersionStorage.py Wed Aug 14 18:07:09 2002
@@ -11,7 +11,7 @@
from ZODB.tests.MinPO import MinPO
from ZODB.tests.StorageTestBase import zodb_unpickle
-
+
class TransactionalUndoVersionStorage:
def _x_dostore(self, *args, **kwargs):
@@ -28,7 +28,7 @@
except KeyError:
pass # not expected
return self._dostore(*args, **kwargs)
-
+
def checkUndoInVersion(self):
oid = self._storage.new_oid()
version = 'one'
@@ -129,7 +129,7 @@
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._x_dostore(oid1, data=MinPO(0), description='create1')
@@ -176,7 +176,7 @@
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._x_dostore(oid1, data=MinPO(0), description='create1')
@@ -227,4 +227,3 @@
self.assertEqual(load_value(oid1), 0)
# after abort, we should see non-version data
self.assertEqual(load_value(oid1, version), 0)
-
=== Zope/lib/python/ZODB/tests/VersionStorage.py 1.13 => 1.14 ===
--- Zope/lib/python/ZODB/tests/VersionStorage.py:1.13 Fri Jan 25 17:19:47 2002
+++ Zope/lib/python/ZODB/tests/VersionStorage.py Wed Aug 14 18:07:09 2002
@@ -12,7 +12,7 @@
from ZODB.tests.MinPO import MinPO
from ZODB.tests.StorageTestBase import zodb_unpickle
-
+
class VersionStorage:
def checkVersionedStoreAndLoad(self):
eq = self.assertEqual
@@ -23,7 +23,7 @@
# And now store some new revisions in a version
version = 'test-version'
revid = self._dostore(oid, revid=revid, data=MinPO(13),
- version=version)
+ version=version)
revid = self._dostore(oid, revid=revid, data=MinPO(14),
version=version)
revid = self._dostore(oid, revid=revid, data=MinPO(15),
@@ -137,12 +137,12 @@
def checkAbortVersion(self):
eq = self.assertEqual
oid, version = self._setup_version()
-
+
# XXX Not sure I can write a test for getSerial() in the
# presence of aborted versions, because FileStorage and
# Berkeley storage give a different answer. I think Berkeley
# is right and FS is wrong.
-
+
## s1 = self._storage.getSerial(oid)
# Now abort the version -- must be done in a transaction
t = Transaction()
@@ -178,7 +178,7 @@
self.assertRaises(POSException.VersionError,
self._storage.abortVersion,
'', t)
-
+
# But now we really try to abort the version
oids = self._storage.abortVersion(version, t)
self._storage.tpc_vote(t)
@@ -258,7 +258,7 @@
eq(zodb_unpickle(data), MinPO(51))
data, revid2 = self._storage.load(oid1, '')
eq(zodb_unpickle(data), MinPO(51))
-
+
# Okay, now let's commit object1 to version2
t = Transaction()
self._storage.tpc_begin(t)
@@ -274,7 +274,7 @@
eq(zodb_unpickle(data), MinPO(54))
# an object can only exist in one version, so a load from
- # version1 should now give the non-version data
+ # version1 should now give the non-version data
data, revid2 = self._storage.load(oid1, version1)
eq(zodb_unpickle(data), MinPO(51))
=== Zope/lib/python/ZODB/tests/speed.py 1.3 => 1.4 ===
--- Zope/lib/python/ZODB/tests/speed.py:1.3 Mon Feb 11 18:40:43 2002
+++ Zope/lib/python/ZODB/tests/speed.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
usage="""Test speed of a ZODB storage
@@ -34,7 +34,7 @@
-M Output means only
"""
-
+
import sys, os, getopt, string, time
sys.path.insert(0, os.getcwd())
@@ -114,11 +114,11 @@
sys.stderr.write("mean:\t%s\t%.4f\t%.4f (s/o)\n" % (r, t, t/r))
db.close()
-
-
+
+
def compress(s):
c=zlib.compressobj()
o=c.compress(s)
- return o+c.flush()
+ return o+c.flush()
if __name__=='__main__': main(sys.argv[1:])
=== Zope/lib/python/ZODB/tests/testActivityMonitor.py 1.2 => 1.3 ===
--- Zope/lib/python/ZODB/tests/testActivityMonitor.py:1.2 Mon Jun 10 16:20:44 2002
+++ Zope/lib/python/ZODB/tests/testActivityMonitor.py Wed Aug 14 18:07:09 2002
@@ -74,7 +74,7 @@
am.setHistoryLength(0.1)
self.assertEqual(am.getHistoryLength(), 0.1)
self.assert_(len(am.log) <= 1)
-
+
def testActivityAnalysis(self):
am = ActivityMonitor(history_length=3600)
c = FakeConnection()
@@ -98,7 +98,7 @@
self.assert_(div['start'] > 0)
self.assert_(div['start'] >= lastend)
self.assert_(div['start'] < div['end'])
-
+
def test_suite():
return unittest.makeSuite(Tests)
=== Zope/lib/python/ZODB/tests/testCache.py 1.8 => 1.9 ===
--- Zope/lib/python/ZODB/tests/testCache.py:1.8 Wed Jun 12 15:46:16 2002
+++ Zope/lib/python/ZODB/tests/testCache.py Wed Aug 14 18:07:09 2002
@@ -50,7 +50,7 @@
if d is None:
d = r[i] = PersistentMapping()
get_transaction().commit()
-
+
for i in range(15):
o = d.get(i)
if o is None:
@@ -116,7 +116,7 @@
c.klass_items()
class LRUCacheTests(CacheTestBase):
-
+
def checkLRU(self):
# verify the LRU behavior of the cache
dataset_size = 5
@@ -166,7 +166,7 @@
CONNS = 3
for i in range(CONNS):
self.noodle_new_connection()
-
+
self.assertEquals(self.db.cacheSize(), CACHE_SIZE * CONNS)
details = self.db.cacheDetailSize()
self.assertEquals(len(details), CONNS)
@@ -183,7 +183,7 @@
CONNS = 3
for i in range(CONNS):
self.noodle_new_connection()
-
+
for klass, count in self.db.cacheDetail():
if klass.endswith('MinPO'):
self.assertEqual(count, CONNS * CACHE_SIZE)
@@ -236,7 +236,7 @@
def checkBogusObject(self):
def add(key, obj):
self.cache[key] = obj
-
+
key = p64(2)
# value isn't persistent
self.assertRaises(TypeError, add, key, 12)
=== Zope/lib/python/ZODB/tests/testDB.py 1.1 => 1.2 ===
--- Zope/lib/python/ZODB/tests/testDB.py:1.1 Mon Apr 15 14:55:11 2002
+++ Zope/lib/python/ZODB/tests/testDB.py Wed Aug 14 18:07:09 2002
@@ -38,4 +38,3 @@
def test_suite():
return unittest.makeSuite(DBTests)
-
=== Zope/lib/python/ZODB/tests/testDemoStorage.py 1.4 => 1.5 ===
--- Zope/lib/python/ZODB/tests/testDemoStorage.py:1.4 Fri Jan 25 12:03:25 2002
+++ Zope/lib/python/ZODB/tests/testDemoStorage.py Wed Aug 14 18:07:09 2002
@@ -24,4 +24,3 @@
loader = unittest.TestLoader()
loader.testMethodPrefix = "check"
unittest.main(testLoader=loader)
-
=== Zope/lib/python/ZODB/tests/testFileStorage.py 1.18 => 1.19 ===
--- Zope/lib/python/ZODB/tests/testFileStorage.py:1.18 Thu Aug 8 14:25:10 2002
+++ Zope/lib/python/ZODB/tests/testFileStorage.py Wed Aug 14 18:07:09 2002
@@ -124,7 +124,7 @@
self.assertRaises(IndexError, lambda i:trans[i], 1)
self.assertEqual(data.oid, oid)
self.assertEqual(data.data, None)
-
+
def test_suite():
suite = unittest.makeSuite(FileStorageTests, 'check')
@@ -140,14 +140,14 @@
runner.run(alltests)
def debug():
- test_suite().debug()
+ test_suite().debug()
def pdebug():
import pdb
pdb.run('debug()')
if __name__=='__main__':
- if len(sys.argv) > 1:
- globals()[sys.argv[1]]()
- else:
- main()
+ if len(sys.argv) > 1:
+ globals()[sys.argv[1]]()
+ else:
+ main()
=== Zope/lib/python/ZODB/tests/testMappingStorage.py 1.3 => 1.4 ===
--- Zope/lib/python/ZODB/tests/testMappingStorage.py:1.3 Fri Jan 25 12:03:25 2002
+++ Zope/lib/python/ZODB/tests/testMappingStorage.py Wed Aug 14 18:07:09 2002
@@ -22,4 +22,3 @@
loader = unittest.TestLoader()
loader.testMethodPrefix = "check"
unittest.main(testLoader=loader)
-
=== Zope/lib/python/ZODB/tests/testPersistentMapping.py 1.3 => 1.4 ===
--- Zope/lib/python/ZODB/tests/testPersistentMapping.py:1.3 Mon Jan 21 11:48:02 2002
+++ Zope/lib/python/ZODB/tests/testPersistentMapping.py Wed Aug 14 18:07:09 2002
@@ -31,7 +31,7 @@
s.store('\000' * 8, None, pickle, '', t)
s.tpc_vote(t)
s.tpc_finish(t)
-
+
db = ZODB.DB(s)
# If the root can be loaded successfully, we should be okay.
r = db.open().root()
=== Zope/lib/python/ZODB/tests/testTransaction.py 1.9 => 1.10 ===
--- Zope/lib/python/ZODB/tests/testTransaction.py:1.9 Wed Aug 14 11:37:08 2002
+++ Zope/lib/python/ZODB/tests/testTransaction.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""
@@ -41,7 +41,7 @@
add in tests for objects which are modified multiple times,
for example an object that gets modified in multiple sub txns.
-
+
"""
import random
@@ -61,9 +61,9 @@
self.nosub1 = DataObject(nost=1)
def tearDown(self):
-
+
Transaction.free_transaction()
-
+
# basic tests with two sub trans jars
# really we only need one, so tests for
# sub1 should identical to tests for sub2
@@ -84,7 +84,7 @@
get_transaction().abort()
- assert self.sub2._p_jar.cabort == 1
+ assert self.sub2._p_jar.cabort == 1
def testSubTransactionCommitCommit(self):
@@ -92,10 +92,10 @@
self.sub2.modify()
get_transaction().commit(1)
-
+
assert self.sub1._p_jar.ctpc_vote == 0
assert self.sub1._p_jar.ctpc_finish == 1
-
+
get_transaction().commit()
assert self.sub1._p_jar.ccommit_sub == 1
@@ -108,13 +108,13 @@
get_transaction().commit(1)
get_transaction().abort()
-
+
assert self.sub1._p_jar.ctpc_vote == 0
assert self.sub1._p_jar.cabort == 0
assert self.sub1._p_jar.cabort_sub == 1
-
+
def testMultipleSubTransactionCommitCommit(self):
-
+
# add it
self.sub1.modify()
@@ -133,7 +133,7 @@
# objects... i don't like this but its an impl artifact
assert self.sub1._p_jar.ctpc_vote == 0
- assert self.sub1._p_jar.ctpc_finish > 0
+ assert self.sub1._p_jar.ctpc_finish > 0
# add another before we do the entire txn commit
self.sub3.modify()
@@ -160,7 +160,7 @@
sub1 calling method tpc_finish
sub2 calling method tpc_finish
"""
-
+
# add it
self.sub1.modify()
@@ -172,7 +172,7 @@
get_transaction().commit(1)
assert self.sub1._p_jar.ctpc_vote == 0
- assert self.sub1._p_jar.ctpc_finish > 0
+ assert self.sub1._p_jar.ctpc_finish > 0
# add another before we do the entire txn commit
self.sub3.modify()
@@ -185,7 +185,7 @@
assert self.sub3._p_jar.cabort == 1
assert self.sub1._p_jar.ccommit_sub == 1
- assert self.sub1._p_jar.ctpc_finish > 1
+ assert self.sub1._p_jar.ctpc_finish > 1
# repeat adding in a nonsub trans jars
@@ -213,7 +213,7 @@
the nosub jar should not have tpc_finish
called on it till the containing txn
ends.
-
+
sub calling method commit
nosub calling method tpc_begin
sub calling method tpc_finish
@@ -221,7 +221,7 @@
nosub calling method abort
sub calling method abort_sub
"""
-
+
self.sub1.modify(tracing='sub')
self.nosub1.modify(tracing='nosub')
@@ -276,10 +276,10 @@
nosub calling method tpc_finish
sub1 calling method tpc_finish
"""
-
+
# add it
self.sub1.modify()
-
+
get_transaction().commit(1)
# add another
@@ -288,15 +288,15 @@
get_transaction().commit(1)
assert self.sub1._p_jar.ctpc_vote == 0
- assert self.nosub1._p_jar.ctpc_vote == 0
- assert self.sub1._p_jar.ctpc_finish > 0
+ assert self.nosub1._p_jar.ctpc_vote == 0
+ assert self.sub1._p_jar.ctpc_finish > 0
# add another before we do the entire txn commit
self.sub2.modify()
# commit the container transaction
get_transaction().commit()
-
+
# we did an implicit sub commit
assert self.sub2._p_jar.ccommit_sub == 1
assert self.sub1._p_jar.ctpc_finish > 1
@@ -308,28 +308,28 @@
# error handling by throwing errors from
# various jar methods
###
-
+
# first the recoverable errors
def testExceptionInAbort(self):
self.sub1._p_jar = SubTransactionJar(errors='abort')
-
+
self.nosub1.modify()
self.sub1.modify(nojar=1)
self.sub2.modify()
-
- try:
+
+ try:
get_transaction().abort()
except TestTxnException: pass
assert self.nosub1._p_jar.cabort == 1
assert self.sub2._p_jar.cabort == 1
-
- def testExceptionInCommit(self):
+
+ def testExceptionInCommit(self):
self.sub1._p_jar = SubTransactionJar(errors='commit')
-
+
self.nosub1.modify()
self.sub1.modify(nojar=1)
@@ -345,14 +345,14 @@
def testExceptionInTpcVote(self):
self.sub1._p_jar = SubTransactionJar(errors='tpc_vote')
-
+
self.nosub1.modify()
self.sub1.modify(nojar=1)
try:
get_transaction().commit()
except TestTxnException: pass
-
+
assert self.nosub1._p_jar.ctpc_finish == 0
assert self.nosub1._p_jar.ccommit == 1
assert self.nosub1._p_jar.ctpc_abort == 1
@@ -363,7 +363,7 @@
"""
ok this test reveals a bug in the TM.py
as the nosub tpc_abort there is ignored.
-
+
nosub calling method tpc_begin
nosub calling method commit
sub calling method tpc_begin
@@ -372,11 +372,11 @@
nosub calling method tpc_abort
"""
self.sub1._p_jar = SubTransactionJar(errors='tpc_begin')
-
+
self.nosub1.modify()
self.sub1.modify(nojar=1)
- try:
+ try:
get_transaction().commit()
except TestTxnException: pass
@@ -401,7 +401,7 @@
### More Failure modes...
# now we mix in some sub transactions
###
-
+
def testExceptionInSubCommitSub(self):
"""
this tests exhibits some odd behavior,
@@ -433,19 +433,19 @@
try:
get_transaction().commit()
except TestTxnException: pass
-
+
# odd this doesn't seem to be entirely deterministic..
if self.sub1._p_jar.ccommit_sub:
- assert self.sub1._p_jar.ctpc_abort == 1
+ assert self.sub1._p_jar.ctpc_abort == 1
else:
- assert self.sub1._p_jar.cabort_sub == 1
-
+ assert self.sub1._p_jar.cabort_sub == 1
+
if self.sub3._p_jar.ccommit_sub:
- assert self.sub3._p_jar.ctpc_abort == 1
+ assert self.sub3._p_jar.ctpc_abort == 1
else:
- assert self.sub3._p_jar.cabort_sub == 1
-
+ assert self.sub3._p_jar.cabort_sub == 1
+
assert self.sub2._p_jar.ctpc_abort == 1
assert self.nosub1._p_jar.ctpc_abort == 1
@@ -458,7 +458,7 @@
self.sub2._p_jar = SubTransactionJar(errors='abort_sub')
self.sub2.modify(nojar=1)
get_transaction().commit(1)
-
+
self.sub3.modify()
try:
@@ -516,7 +516,7 @@
succeed += 1
elif jar.ctpc_abort:
fail += 1
-
+
if Transaction.hosed:
self.assert_(fail > 0 and succeed > 0)
break
@@ -526,7 +526,7 @@
self.setUp()
else:
self.fail("Couldn't provoke hosed state.")
-
+
self.sub2.modify()
try:
@@ -566,22 +566,22 @@
self.ctpc_vote = 0
self.ctpc_finish = 0
self.cabort_sub = 0
- self.ccommit_sub = 0
-
+ self.ccommit_sub = 0
+
def check(self, method):
if self.tracing:
print '%s calling method %s'%(str(self.tracing),method)
-
+
if ((type(self.errors) is TupleType and method in self.errors)
or method == self.errors):
raise TestTxnException("error %s" % method)
- ## basic jar txn interface
+ ## basic jar txn interface
def abort(self, *args):
self.check('abort')
self.cabort += 1
-
+
def commit(self, *args):
self.check('commit')
self.ccommit += 1
@@ -607,11 +607,11 @@
def abort_sub(self, txn):
self.check('abort_sub')
self.cabort_sub = 1
-
+
def commit_sub(self, txn):
self.check('commit_sub')
self.ccommit_sub = 1
-
+
class NoSubTransactionJar(BasicJar): pass
def test_suite():
=== Zope/lib/python/ZODB/tests/testUtils.py 1.1 => 1.2 ===
--- Zope/lib/python/ZODB/tests/testUtils.py:1.1 Fri Oct 5 17:12:21 2001
+++ Zope/lib/python/ZODB/tests/testUtils.py Wed Aug 14 18:07:09 2002
@@ -14,7 +14,7 @@
large = [random.randrange(1L<<32, 1L<<64, int=long)
for i in range(NUM)]
all = small + large
-
+
def checkLongToStringToLong(self):
for num in self.all:
s = p64(num)
@@ -33,9 +33,8 @@
def test_suite():
return unittest.makeSuite(TestUtils, 'check')
-
+
if __name__ == "__main__":
loader = unittest.TestLoader()
loader.testMethodPrefix = "check"
unittest.main(testLoader=loader)
-
=== Zope/lib/python/ZODB/tests/testZODB.py 1.3 => 1.4 ===
--- Zope/lib/python/ZODB/tests/testZODB.py:1.3 Thu Aug 8 14:25:10 2002
+++ Zope/lib/python/ZODB/tests/testZODB.py Wed Aug 14 18:07:09 2002
@@ -72,7 +72,7 @@
def checkDuplicateAborted(self):
self.checkDuplicate(abort_it=1, dup_name='test_duplicate_aborted')
-
+
class ZODBTests(unittest.TestCase, ExportImportTests):
@@ -103,14 +103,14 @@
runner.run(alltests)
def debug():
- test_suite().debug()
+ test_suite().debug()
def pdebug():
import pdb
pdb.run('debug()')
if __name__=='__main__':
- if len(sys.argv) > 1:
- globals()[sys.argv[1]]()
- else:
- main()
+ if len(sys.argv) > 1:
+ globals()[sys.argv[1]]()
+ else:
+ main()
=== Zope/lib/python/ZODB/tests/testfsIndex.py 1.4 => 1.5 ===
--- Zope/lib/python/ZODB/tests/testfsIndex.py:1.4 Tue Feb 12 17:33:08 2002
+++ Zope/lib/python/ZODB/tests/testfsIndex.py Wed Aug 14 18:07:09 2002
@@ -1,4 +1,3 @@
-
import unittest, sys
from ZODB.fsIndex import fsIndex
from ZODB.utils import p64
@@ -14,7 +13,7 @@
for i in range(0,200):
self.assertEqual((i,index[p64(i*1000)]), (i,(i*1000L+1)))
-
+
self.assertEqual(len(index), 200)
key=p64(2000)
@@ -38,12 +37,12 @@
for i in range(400,600):
d[p64(i*1000)]=(i*1000L+1)
-
+
index.update(d)
for i in range(100, 500):
d[p64(i*1000)]=(i*1000L+2)
-
+
index.update(d)
self.assertEqual(index.get(p64(2000)), 2001)