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
Labels
Merge Requests
144
Merge Requests
144
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
fb73955b
Commit
fb73955b
authored
Jun 21, 2019
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XXX use mock ?
parent
b92efcc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
product/ERP5Catalog/tests/testERP5Catalog.py
product/ERP5Catalog/tests/testERP5Catalog.py
+11
-5
No files found.
product/ERP5Catalog/tests/testERP5Catalog.py
View file @
fb73955b
...
...
@@ -33,6 +33,7 @@ import threading
import
traceback
import
unittest
import
httplib
import
mock
import
six
from
AccessControl
import
getSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
...
...
@@ -318,8 +319,16 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
rendez_vous
.
set
()
assert
unblock_activity
.
wait
(
10
),
print_all_stacks
()
orig_catalogObjectList
(
*
args
,
**
kw
)
catalog_tool_class
.
catalogObjectList
=
catalogObjectList
try
:
def
synchronise
(
*
args
,
**
kw
):
rendez_vous
.
set
()
assert
unblock_activity
.
wait
(
10
),
print_all_stacks
()
return
mock
.
DEFAULT
with
mock
.
patch
.
object
(
catalog_tool_class
,
'catalogObjectList'
,
# wraps=catalog_tool_class.catalogObjectList,
side_effect
=
synchronise
,
):
# Let pending activities (indexation) start.
activity_thread
.
start
()
# Wait until indexation is indeed initiated.
...
...
@@ -335,9 +344,6 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
unblock_activity
.
set
()
activity_thread
.
join
(
10
)
assert
not
activity_thread
.
is_alive
()
finally
:
# Un-monkey-patch.
catalog_tool_class
.
catalogObjectList
=
orig_catalogObjectList
# Document must be indexed: unindexation must have waited for indexation
# to finish, so runValidablePendingActivities(..., 1) must have been
# a no-op.
...
...
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