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
5a760e88
Commit
5a760e88
authored
Oct 03, 2018
by
Sune Broendum Woeller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
failing test for #208
parent
6c9748dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
src/ZODB/tests/testThreadedShutdown.py
src/ZODB/tests/testThreadedShutdown.py
+57
-0
No files found.
src/ZODB/tests/testThreadedShutdown.py
0 → 100644
View file @
5a760e88
import
sys
import
threading
import
time
import
unittest
import
transaction
import
ZODB
class
ZODBClientThread
(
threading
.
Thread
):
def
__init__
(
self
,
db
,
test
):
threading
.
Thread
.
__init__
(
self
)
self
.
_exc_info
=
None
# self.setDaemon(1)
self
.
db
=
db
self
.
test
=
test
def
run
(
self
):
conn
=
self
.
db
.
open
()
conn
.
sync
()
time
.
sleep
(
15
)
# conn.close calls self.transaction_manager.unregisterSynch(self)
# and this succeeds.
conn
.
close
()
class
ShutdownTest
(
ZODB
.
tests
.
util
.
TestCase
):
def
setUp
(
self
):
# Our default transaction manager is
# transaction._manager.ThreadTransactionManager
# so no need to set it.
ZODB
.
tests
.
util
.
TestCase
.
setUp
(
self
)
self
.
_storage
=
ZODB
.
FileStorage
.
FileStorage
(
'ZODBTests.fs'
,
create
=
1
)
self
.
_db
=
ZODB
.
DB
(
self
.
_storage
)
def
check_shutdown
(
self
):
client_thread
=
ZODBClientThread
(
self
.
_db
,
self
)
client_thread
.
start
()
# calls conn._release_resources, that calls conn.close(),
# that calls conn.transaction_manager.unregisterSynch(self),
# but from a different thread, so transaction_manager._synchs
# have different contents.
# So this is expected to fail with a keyerror:
self
.
_db
.
close
()
def
tearDown
(
self
):
ZODB
.
tests
.
util
.
TestCase
.
tearDown
(
self
)
def
test_suite
():
return
unittest
.
makeSuite
(
ShutdownTest
,
"check"
)
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