Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
f7739565
Commit
f7739565
authored
Apr 12, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetic changes to ExceptionInSubAbortSub,
including some use of assert/fail methods instead of assert stmt.
parent
75ee5c7a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
src/ZODB/tests/testTransaction.py
src/ZODB/tests/testTransaction.py
+15
-18
No files found.
src/ZODB/tests/testTransaction.py
View file @
f7739565
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
"""
"""
Revision information:
Revision information:
$Id: testTransaction.py,v 1.
5 2002/03/12 19:44:13 k_vertigo
Exp $
$Id: testTransaction.py,v 1.
6 2002/04/12 18:22:45 jeremy
Exp $
"""
"""
"""
"""
...
@@ -44,9 +44,8 @@ TODO
...
@@ -44,9 +44,8 @@ TODO
"""
"""
import
unittest
from
types
import
TupleType
from
types
import
TupleType
import
unittest
from
ZODB
import
Transaction
from
ZODB
import
Transaction
...
@@ -467,31 +466,32 @@ class TransactionTests(unittest.TestCase):
...
@@ -467,31 +466,32 @@ class TransactionTests(unittest.TestCase):
assert
self
.
nosub1
.
_p_jar
.
ctpc_abort
==
1
assert
self
.
nosub1
.
_p_jar
.
ctpc_abort
==
1
def
testExceptionInSubAbortSub
(
self
):
def
testExceptionInSubAbortSub
(
self
):
self
.
sub1
.
_p_jar
=
SubTransactionJar
(
errors
=
'commit_sub'
)
self
.
sub1
.
_p_jar
=
SubTransactionJar
(
errors
=
'commit_sub'
)
self
.
sub1
.
modify
(
nojar
=
1
)
self
.
sub1
.
modify
(
nojar
=
1
)
get_transaction
().
commit
(
1
)
get_transaction
().
commit
(
1
)
self
.
nosub1
.
modify
()
self
.
nosub1
.
modify
()
self
.
sub2
.
_p_jar
=
SubTransactionJar
(
errors
=
'abort_sub'
)
self
.
sub2
.
_p_jar
=
SubTransactionJar
(
errors
=
'abort_sub'
)
self
.
sub2
.
modify
(
nojar
=
1
)
self
.
sub2
.
modify
(
nojar
=
1
)
get_transaction
().
commit
(
1
)
get_transaction
().
commit
(
1
)
self
.
sub3
.
modify
()
self
.
sub3
.
modify
()
try
:
try
:
get_transaction
().
commit
()
get_transaction
().
commit
()
except
TestTxnException
:
pass
except
TestTxnException
,
err
:
pass
else
:
self
.
fail
(
"expected transaction to fail"
)
# The last commit failed. If the commit_sub() method was
# called, then tpc_abort() should be called to abort the
# actual transaction. If not, then calling abort_sub() is
# sufficient.
if
self
.
sub3
.
_p_jar
.
ccommit_sub
==
1
:
if
self
.
sub3
.
_p_jar
.
ccommit_sub
==
1
:
assert
self
.
sub3
.
_p_jar
.
ctpc_abort
==
1
self
.
assertEqual
(
self
.
sub3
.
_p_jar
.
ctpc_abort
,
1
)
else
:
else
:
assert
self
.
sub3
.
_p_jar
.
cabort_sub
==
1
self
.
assertEqual
(
self
.
sub3
.
_p_jar
.
cabort_sub
,
1
)
### XXX
### XXX
def
BUGtestExceptionInSubTpcBegin
(
self
):
def
BUGtestExceptionInSubTpcBegin
(
self
):
...
@@ -603,15 +603,12 @@ class BasicJar:
...
@@ -603,15 +603,12 @@ class BasicJar:
self
.
ccommit_sub
=
0
self
.
ccommit_sub
=
0
def
check
(
self
,
method
):
def
check
(
self
,
method
):
if
self
.
tracing
:
if
self
.
tracing
:
print
'%s calling method %s'
%
(
str
(
self
.
tracing
),
method
)
print
'%s calling method %s'
%
(
str
(
self
.
tracing
),
method
)
if
((
type
(
self
.
errors
)
is
TupleType
and
method
in
self
.
errors
)
if
(
type
(
self
.
errors
)
is
TupleType
and
method
in
self
.
errors
)
or
\
or
method
==
self
.
errors
):
method
==
self
.
errors
:
raise
TestTxnException
(
"error %s"
%
method
)
raise
TestTxnException
(
" error %s"
%
method
)
## basic jar txn interface
## basic jar txn interface
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment