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
Bryan Kaperick
erp5
Commits
f83cf537
Commit
f83cf537
authored
Aug 27, 2014
by
Jérome Perrin
Committed by
Gabriel Monnerat
Aug 28, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep a reference to _module_cache_set in each test request
see
3a92d8b6
parent
e26cc4bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
product/ERP5Type/tests/ERP5TypeLiveTestCase.py
product/ERP5Type/tests/ERP5TypeLiveTestCase.py
+12
-0
No files found.
product/ERP5Type/tests/ERP5TypeLiveTestCase.py
View file @
f83cf537
...
@@ -37,6 +37,7 @@ from Testing import ZopeTestCase
...
@@ -37,6 +37,7 @@ from Testing import ZopeTestCase
from
Testing.ZopeTestCase
import
PortalTestCase
,
user_name
from
Testing.ZopeTestCase
import
PortalTestCase
,
user_name
from
Products.CMFCore.utils
import
getToolByName
from
Products.CMFCore.utils
import
getToolByName
from
Products.ERP5Type.tests.ProcessingNodeTestCase
import
ProcessingNodeTestCase
from
Products.ERP5Type.tests.ProcessingNodeTestCase
import
ProcessingNodeTestCase
from
Products.ERP5Type.Globals
import
get_request
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
\
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
\
ERP5TypeTestCaseMixin
,
ERP5TypeTestCase
ERP5TypeTestCaseMixin
,
ERP5TypeTestCase
from
glob
import
glob
from
glob
import
glob
...
@@ -74,10 +75,18 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin):
...
@@ -74,10 +75,18 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin):
def
getPortal
(
self
):
def
getPortal
(
self
):
"""Returns the portal object, i.e. the "fixture root".
"""Returns the portal object, i.e. the "fixture root".
Rewrap the portal in an independant request for this test.
"""
"""
if
self
.
portal
is
not
None
:
if
self
.
portal
is
not
None
:
return
self
.
portal
return
self
.
portal
# _module_cache_set is used to keep a reference to the code of modules
# before they get reloaded. As we will use another request we need to
# make sure that we still have a reference to _module_cache_set so that
# it does not get garbage collected.
module_cache_set
=
getattr
(
get_request
(),
'_module_cache_set'
,
None
)
from
Products.ERP5.ERP5Site
import
getSite
from
Products.ERP5.ERP5Site
import
getSite
site
=
getSite
()
site
=
getSite
()
# reconstruct the acquistion chain with an independant request.
# reconstruct the acquistion chain with an independant request.
...
@@ -85,6 +94,9 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin):
...
@@ -85,6 +94,9 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin):
from
Testing.ZopeTestCase.utils
import
makerequest
from
Testing.ZopeTestCase.utils
import
makerequest
portal
=
getattr
(
makerequest
(
site
.
aq_parent
),
site
.
getId
())
portal
=
getattr
(
makerequest
(
site
.
aq_parent
),
site
.
getId
())
if
module_cache_set
:
portal
.
REQUEST
.
_module_cache_set
=
module_cache_set
# Make the various get_request patches return this request.
# Make the various get_request patches return this request.
# This is for ERP5TypeTestCase patch
# This is for ERP5TypeTestCase patch
from
Testing.ZopeTestCase.connections
import
registry
from
Testing.ZopeTestCase.connections
import
registry
...
...
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