Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hamza
erp5
Commits
35c20cf9
Commit
35c20cf9
authored
Jun 24, 2019
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testERP5Catalog: TransactionThread reraises exceptions on join.
parent
8cf35515
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
12 deletions
+32
-12
product/ERP5Catalog/tests/testERP5Catalog.py
product/ERP5Catalog/tests/testERP5Catalog.py
+32
-12
No files found.
product/ERP5Catalog/tests/testERP5Catalog.py
View file @
35c20cf9
...
...
@@ -33,6 +33,7 @@ import threading
import
traceback
import
unittest
import
httplib
import
six
from
AccessControl
import
getSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
from
DateTime
import
DateTime
...
...
@@ -67,20 +68,39 @@ class TransactionThread(threading.Thread):
self
.
root_physical_path
=
portal
.
getPhysicalPath
()
self
.
payload
=
payload
self
.
payload_kw
=
payload_kw
self
.
exception
=
None
def
run
(
self
):
# Get a new portal, in a new transactional connection bound to default
# transaction manager (which should be the threaded transaction manager).
portal
=
self
.
zodb
.
open
().
root
()[
'Application'
].
unrestrictedTraverse
(
self
.
root_physical_path
,
)
# Trigger ERP5Site magic
portal
.
getSiteManager
()
# Trigger skin magic
portal
.
changeSkin
(
None
)
# Login
newSecurityManager
(
None
,
portal
.
acl_users
.
getUser
(
'ERP5TypeTestCase'
))
self
.
payload
(
portal
=
portal
,
**
dict
(
self
.
payload_kw
))
try
:
# Get a new portal, in a new transactional connection bound to default
# transaction manager (which should be the threaded transaction manager).
portal
=
self
.
zodb
.
open
().
root
()[
'Application'
].
unrestrictedTraverse
(
self
.
root_physical_path
,
)
# Trigger ERP5Site magic
portal
.
getSiteManager
()
# Trigger skin magic
portal
.
changeSkin
(
None
)
# Login
newSecurityManager
(
None
,
portal
.
acl_users
.
getUser
(
'ERP5TypeTestCase'
))
self
.
payload
(
portal
=
portal
,
**
dict
(
self
.
payload_kw
))
except
Exception
as
self
.
exception
:
if
six
.
PY2
:
self
.
exception
.
__traceback__
=
sys
.
exc_info
()[
2
]
def
join
(
self
,
*
args
,
**
kw
):
super
(
TransactionThread
,
self
).
join
(
*
args
,
**
kw
)
if
not
self
.
is_alive
():
exception
=
self
.
exception
# Break reference cycle:
# run frame -> self -> exception -> __traceback__ -> run frame
# Not re-raising on subsequent calls is kind of a bug, but it's really up
# to caller to either not ignore exceptions or keep them around.
self
.
exception
=
None
if
exception
is
not
None
:
if
six
.
PY3
:
raise
exception
six
.
reraise
(
exception
,
None
,
exception
.
__traceback__
)
class
IndexableDocument
(
ObjectManager
):
...
...
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