Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
transaction
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
Kirill Smelkov
transaction
Commits
5c10c95c
Commit
5c10c95c
authored
Dec 17, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coverage for TransactionManager as a context manager.
parent
be2772b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
transaction/tests/test__manager.py
transaction/tests/test__manager.py
+32
-0
No files found.
transaction/tests/test__manager.py
View file @
5c10c95c
...
...
@@ -157,6 +157,38 @@ class TransactionManagerTests(unittest.TestCase):
tm
.
abort
()
self
.
assertTrue
(
txn
.
_aborted
)
def
test_as_context_manager_wo_error
(
self
):
class
_Test
(
object
):
_committed
=
False
_aborted
=
False
def
commit
(
self
):
self
.
_committed
=
True
def
abort
(
self
):
self
.
_aborted
=
True
tm
=
self
.
_makeOne
()
with
tm
:
tm
.
_txn
=
txn
=
_Test
()
self
.
assertTrue
(
txn
.
_committed
)
self
.
assertFalse
(
txn
.
_aborted
)
def
test_as_context_manager_w_error
(
self
):
class
_Test
(
object
):
_committed
=
False
_aborted
=
False
def
commit
(
self
):
self
.
_committed
=
True
def
abort
(
self
):
self
.
_aborted
=
True
tm
=
self
.
_makeOne
()
try
:
with
tm
:
tm
.
_txn
=
txn
=
_Test
()
1
/
0
except
ZeroDivisionError
:
pass
self
.
assertFalse
(
txn
.
_committed
)
self
.
assertTrue
(
txn
.
_aborted
)
# basic tests with two sub trans jars
# really we only need one, so tests for
# sub1 should identical to tests for sub2
...
...
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