[Zope3-checkins] CVS: ZODB/src/transaction/tests -
test_transaction.py:1.2
Jeremy Hylton
jeremy at zope.com
Fri Apr 16 11:58:40 EDT 2004
Update of /cvs-repository/ZODB/src/transaction/tests
In directory cvs.zope.org:/tmp/cvs-serv11088/src/transaction/tests
Modified Files:
test_transaction.py
Log Message:
Replace use of builtin get_transaction() with explicit transaction module.
=== ZODB/src/transaction/tests/test_transaction.py 1.1 => 1.2 ===
--- ZODB/src/transaction/tests/test_transaction.py:1.1 Thu Apr 15 20:19:38 2004
+++ ZODB/src/transaction/tests/test_transaction.py Fri Apr 16 11:58:10 2004
@@ -64,7 +64,7 @@
self.sub1.modify()
self.sub2.modify()
- get_transaction().commit()
+ transaction.commit()
assert self.sub1._p_jar.ccommit_sub == 0
assert self.sub1._p_jar.ctpc_finish == 1
@@ -74,13 +74,13 @@
self.sub1.modify()
self.sub2.modify()
- get_transaction().abort()
+ transaction.abort()
assert self.sub2._p_jar.cabort == 1
def testTransactionNote(self):
- t = get_transaction()
+ t = transaction.get()
t.note('This is a note.')
self.assertEqual(t.description, 'This is a note.')
@@ -94,12 +94,12 @@
self.sub1.modify()
self.sub2.modify()
- get_transaction().commit(1)
+ transaction.commit(1)
assert self.sub1._p_jar.ctpc_vote == 0
assert self.sub1._p_jar.ctpc_finish == 1
- get_transaction().commit()
+ transaction.commit()
assert self.sub1._p_jar.ccommit_sub == 1
assert self.sub1._p_jar.ctpc_vote == 1
@@ -109,8 +109,8 @@
self.sub1.modify()
self.sub2.modify()
- get_transaction().commit(1)
- get_transaction().abort()
+ transaction.commit(1)
+ transaction.abort()
assert self.sub1._p_jar.ctpc_vote == 0
assert self.sub1._p_jar.cabort == 0
@@ -118,12 +118,12 @@
def testMultipleSubTransactionCommitCommit(self):
self.sub1.modify()
- get_transaction().commit(1)
+ transaction.commit(1)
self.sub2.modify()
# reset a flag on the original to test it again
self.sub1.ctpc_finish = 0
- get_transaction().commit(1)
+ transaction.commit(1)
# this is interesting.. we go through
# every subtrans commit with all subtrans capable
@@ -135,7 +135,7 @@
# add another before we do the entire txn commit
self.sub3.modify()
- get_transaction().commit()
+ transaction.commit()
# we did an implicit sub commit, is this impl artifact?
assert self.sub3._p_jar.ccommit_sub == 1
@@ -161,12 +161,12 @@
# add it
self.sub1.modify()
- get_transaction().commit(1)
+ transaction.commit(1)
# add another
self.sub2.modify()
- get_transaction().commit(1)
+ transaction.commit(1)
assert self.sub1._p_jar.ctpc_vote == 0
assert self.sub1._p_jar.ctpc_finish > 0
@@ -175,10 +175,10 @@
self.sub3.modify()
# abort the sub transaction
- get_transaction().abort(1)
+ transaction.abort(1)
# commit the container transaction
- get_transaction().commit()
+ transaction.commit()
assert self.sub3._p_jar.cabort == 1
assert self.sub1._p_jar.ccommit_sub == 1
@@ -190,7 +190,7 @@
self.nosub1.modify()
- get_transaction().commit()
+ transaction.commit()
assert self.nosub1._p_jar.ctpc_finish == 1
@@ -198,7 +198,7 @@
self.nosub1.modify()
- get_transaction().abort()
+ transaction.abort()
assert self.nosub1._p_jar.ctpc_finish == 0
assert self.nosub1._p_jar.cabort == 1
@@ -222,7 +222,7 @@
self.sub1.modify(tracing='sub')
self.nosub1.modify(tracing='nosub')
- get_transaction().commit(1)
+ transaction.commit(1)
assert self.sub1._p_jar.ctpc_finish == 1
@@ -230,7 +230,7 @@
# in a subtrans
assert self.nosub1._p_jar.ctpc_finish == 0
- get_transaction().abort()
+ transaction.abort()
assert self.nosub1._p_jar.cabort == 1
assert self.sub1._p_jar.cabort_sub == 1
@@ -240,11 +240,11 @@
self.sub1.modify()
self.nosub1.modify()
- get_transaction().commit(1)
+ transaction.commit(1)
assert self.nosub1._p_jar.ctpc_vote == 0
- get_transaction().commit()
+ transaction.commit()
#assert self.nosub1._p_jar.ccommit_sub == 0
assert self.nosub1._p_jar.ctpc_vote == 1
@@ -277,12 +277,12 @@
# add it
self.sub1.modify()
- get_transaction().commit(1)
+ transaction.commit(1)
# add another
self.nosub1.modify()
- get_transaction().commit(1)
+ transaction.commit(1)
assert self.sub1._p_jar.ctpc_vote == 0
assert self.nosub1._p_jar.ctpc_vote == 0
@@ -292,7 +292,7 @@
self.sub2.modify()
# commit the container transaction
- get_transaction().commit()
+ transaction.commit()
# we did an implicit sub commit
assert self.sub2._p_jar.ccommit_sub == 1
@@ -317,7 +317,7 @@
self.sub2.modify()
try:
- get_transaction().abort()
+ transaction.abort()
except TestTxnException: pass
assert self.nosub1._p_jar.cabort == 1
@@ -331,7 +331,7 @@
self.sub1.modify(nojar=1)
try:
- get_transaction().commit()
+ transaction.commit()
except TestTxnException: pass
assert self.nosub1._p_jar.ctpc_finish == 0
@@ -346,7 +346,7 @@
self.sub1.modify(nojar=1)
try:
- get_transaction().commit()
+ transaction.commit()
except TestTxnException: pass
assert self.nosub1._p_jar.ctpc_finish == 0
@@ -372,7 +372,7 @@
self.sub1.modify(nojar=1)
try:
- get_transaction().commit()
+ transaction.commit()
except TestTxnException: pass
assert self.nosub1._p_jar.ctpc_abort == 1
@@ -386,7 +386,7 @@
self.sub1.modify(nojar=1)
try:
- get_transaction().commit()
+ transaction.commit()
except TestTxnException:
pass
@@ -403,19 +403,19 @@
# they come out of the dictionary.
self.sub1.modify()
- get_transaction().commit(1)
+ transaction.commit(1)
self.nosub1.modify()
self.sub2._p_jar = SubTransactionJar(errors='commit_sub')
self.sub2.modify(nojar=1)
- get_transaction().commit(1)
+ transaction.commit(1)
self.sub3.modify()
try:
- get_transaction().commit()
+ transaction.commit()
except TestTxnException:
pass
@@ -442,17 +442,17 @@
self.sub1._p_jar = SubTransactionJar(errors='commit_sub')
self.sub1.modify(nojar=1)
- get_transaction().commit(1)
+ transaction.commit(1)
self.nosub1.modify()
self.sub2._p_jar = SubTransactionJar(errors='abort_sub')
self.sub2.modify(nojar=1)
- get_transaction().commit(1)
+ transaction.commit(1)
self.sub3.modify()
try:
- get_transaction().commit()
+ transaction.commit()
except TestTxnException, err:
pass
else:
@@ -483,7 +483,7 @@
## obj.modify(nojar=1)
## try:
-## get_transaction().commit()
+## transaction.commit()
## except TestTxnException:
## pass
@@ -492,7 +492,7 @@
## self.sub2.modify()
## try:
-## get_transaction().commit()
+## transaction.commit()
## except Transaction.POSException.TransactionError:
## pass
## else:
@@ -511,7 +511,7 @@
self._p_jar = NoSubTransactionJar(tracing=tracing)
else:
self._p_jar = SubTransactionJar(tracing=tracing)
- get_transaction().register(self)
+ transaction.get().register(self)
class TestTxnException(Exception):
pass
More information about the Zope3-Checkins
mailing list