[Zope3-checkins] CVS: Zope3/src/ZEO/tests - ThreadTests.py:1.9
InvalidationTests.py:1.11 ConnectionTests.py:1.53
CommitLockTests.py:1.19 Cache.py:1.12
Jeremy Hylton
jeremy at zope.com
Wed Mar 31 22:57:31 EST 2004
Update of /cvs-repository/Zope3/src/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv23866/src/ZEO/tests
Modified Files:
ThreadTests.py InvalidationTests.py ConnectionTests.py
CommitLockTests.py Cache.py
Log Message:
Merge the jeremy-txn-branch to the head.
This branch introduces a new transaction API. The key features are:
- top-level functions in transaction -- get(), commit(), abort()
- explicit transaction manager objects
- Transaction objects are used for exactly one transaction
- support for transaction synchronizers
The changes here are still provisional, but we want to get them off an
obscure branch and onto the head for further development.
=== Zope3/src/ZEO/tests/ThreadTests.py 1.8 => 1.9 ===
--- Zope3/src/ZEO/tests/ThreadTests.py:1.8 Thu Feb 26 19:31:52 2004
+++ Zope3/src/ZEO/tests/ThreadTests.py Wed Mar 31 22:56:59 2004
@@ -15,9 +15,8 @@
import threading
-from ZODB.Transaction import Transaction
+import transaction
from ZODB.tests.StorageTestBase import zodb_pickle, MinPO
-
import ZEO.ClientStorage
ZERO = '\0'*8
@@ -25,7 +24,7 @@
class BasicThread(threading.Thread):
def __init__(self, storage, doNextEvent, threadStartedEvent):
self.storage = storage
- self.trans = Transaction()
+ self.trans = transaction.Transaction()
self.doNextEvent = doNextEvent
self.threadStartedEvent = threadStartedEvent
self.gotValueError = 0
=== Zope3/src/ZEO/tests/InvalidationTests.py 1.10 => 1.11 ===
--- Zope3/src/ZEO/tests/InvalidationTests.py:1.10 Tue Jan 6 20:46:14 2004
+++ Zope3/src/ZEO/tests/InvalidationTests.py Wed Mar 31 22:56:59 2004
@@ -16,6 +16,8 @@
import time
from random import Random
+import transaction
+
from BTrees.check import check, display
from BTrees.OOBTree import OOBTree
@@ -70,8 +72,7 @@
self.step = step
self.sleep = sleep
self.added_keys = []
- self.cn = self.db.open()
- self.cn.setLocalTransaction()
+ self.cn = self.db.open(txn_mgr=transaction.TransactionManager())
self.cn.sync()
def doStep(self):
=== Zope3/src/ZEO/tests/ConnectionTests.py 1.52 => 1.53 ===
--- Zope3/src/ZEO/tests/ConnectionTests.py:1.52 Thu Feb 26 19:31:52 2004
+++ Zope3/src/ZEO/tests/ConnectionTests.py Wed Mar 31 22:56:59 2004
@@ -29,13 +29,15 @@
from ZEO.tests import forker
from ZODB.DB import DB
-from ZODB.Transaction import get_transaction, Transaction
from ZODB.POSException import ReadOnlyError, ConflictError
from ZODB.tests.StorageTestBase import StorageTestBase
from ZODB.tests.MinPO import MinPO
from ZODB.tests.StorageTestBase \
import zodb_pickle, zodb_unpickle, handle_all_serials, handle_serials
+import transaction
+from transaction import Transaction
+
ZERO = '\0'*8
class TestServerStub(ZEO.ServerStub.StorageServer):
@@ -465,7 +467,7 @@
zLOG.LOG("checkReconnection", zLOG.INFO,
"Error after server restart; retrying.",
error=sys.exc_info())
- get_transaction().abort()
+ transaction.abort()
# Give the other thread a chance to run.
time.sleep(0.1)
zLOG.LOG("checkReconnection", zLOG.INFO, "finished")
@@ -552,7 +554,7 @@
r1 = c1.root()
r1["a"] = MinPO("a")
- get_transaction().commit()
+ transaction.commit()
db2 = DB(self.openClientStorage())
r2 = db2.open().root()
@@ -560,7 +562,7 @@
self.assertEqual(r2["a"].value, "a")
r2["b"] = MinPO("b")
- get_transaction().commit()
+ transaction.commit()
# make sure the invalidation is received in the other client
for i in range(10):
=== Zope3/src/ZEO/tests/CommitLockTests.py 1.18 => 1.19 ===
--- Zope3/src/ZEO/tests/CommitLockTests.py:1.18 Wed Feb 18 16:27:40 2004
+++ Zope3/src/ZEO/tests/CommitLockTests.py Wed Mar 31 22:56:59 2004
@@ -16,8 +16,8 @@
import threading
import time
-from ZODB.Transaction import Transaction
from persistent.TimeStamp import TimeStamp
+import transaction
from ZODB.tests.StorageTestBase import zodb_pickle, MinPO
import ZEO.ClientStorage
@@ -97,7 +97,7 @@
self._storages = []
def _start_txn(self):
- txn = Transaction()
+ txn = transaction.Transaction()
self._storage.tpc_begin(txn)
oid = self._storage.new_oid()
self._storage.store(oid, ZERO, zodb_pickle(MinPO(1)), '', txn)
@@ -112,7 +112,7 @@
for i in range(self.NUM_CLIENTS):
storage = self._duplicate_client()
- txn = Transaction()
+ txn = transaction.Transaction()
tid = self._get_timestamp()
t = WorkerThread(self, storage, txn)
=== Zope3/src/ZEO/tests/Cache.py 1.11 => 1.12 ===
--- Zope3/src/ZEO/tests/Cache.py:1.11 Wed Feb 18 16:27:40 2004
+++ Zope3/src/ZEO/tests/Cache.py Wed Mar 31 22:56:59 2004
@@ -13,9 +13,10 @@
##############################################################################
"""Tests of the ZEO cache"""
-from ZODB.Transaction import Transaction
from ZODB.tests.MinPO import MinPO
from ZODB.tests.StorageTestBase import zodb_unpickle
+
+from transaction import Transaction
class TransUndoStorageWithCache:
More information about the Zope3-Checkins
mailing list