[Zope3-checkins] CVS: ZODB4/src/zodb/storage/tests - conflict.py:1.3
Barry Warsaw
barry@wooz.org
Wed, 22 Jan 2003 14:57:27 -0500
Update of /cvs-repository/ZODB4/src/zodb/storage/tests
In directory cvs.zope.org:/tmp/cvs-serv14253
Modified Files:
conflict.py
Log Message:
Minor and various cleanups
=== ZODB4/src/zodb/storage/tests/conflict.py 1.2 => 1.3 ===
--- ZODB4/src/zodb/storage/tests/conflict.py:1.2 Wed Dec 25 09:12:20 2002
+++ ZODB4/src/zodb/storage/tests/conflict.py Wed Jan 22 14:57:24 2003
@@ -1,6 +1,6 @@
##############################################################################
#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
@@ -13,27 +13,23 @@
##############################################################################
"""Tests for application-level conflict resolution."""
+from persistence import Persistent
+
from zodb.ztransaction import Transaction
from zodb.interfaces import ConflictError, UndoError
from zodb.conflict import ResolveObjectReader
-from persistence import Persistent
-
from zodb.storage.tests.base import zodb_unpickle, zodb_pickle
-import sys
-import types
-from cPickle import Pickler, Unpickler
-from cStringIO import StringIO
class PCounter(Persistent):
-
_value = 0
def __repr__(self):
return "<PCounter %d>" % self._value
def inc(self):
- self._value = self._value + 1
+ self._value += 1
+
class RPCounter(PCounter):
"""Version of PCounter that supports conflict resolution."""
@@ -61,8 +57,8 @@
def _p_resolveConflict(self, oldState, savedState):
raise RuntimeError, "Can't get here; not enough args"
-class ConflictResolvingStorage:
+class ConflictResolvingStorage:
def checkResolve(self):
obj = RPCounter()
obj.inc()
@@ -186,7 +182,6 @@
# 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()
@@ -200,6 +195,5 @@
tid = info[1]['id']
t = Transaction()
self._storage.tpc_begin(t)
- self.assertRaises(UndoError, self._storage.transactionalUndo,
- tid, t)
+ self.assertRaises(UndoError, self._storage.transactionalUndo, tid, t)
self._storage.tpc_abort(t)