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
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
d56cc014
Commit
d56cc014
authored
Mar 17, 2023
by
Jérome Perrin
Committed by
Kazuhiko Shiozaki
Mar 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMFActivity py3
parent
a3ab6e87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
product/CMFActivity/Activity/SQLBase.py
product/CMFActivity/Activity/SQLBase.py
+3
-3
product/CMFActivity/tests/testCMFActivity.py
product/CMFActivity/tests/testCMFActivity.py
+5
-4
No files found.
product/CMFActivity/Activity/SQLBase.py
View file @
d56cc014
...
@@ -245,7 +245,7 @@ def getNow(db):
...
@@ -245,7 +245,7 @@ def getNow(db):
Note that this value is not cached, and is not transactionnal on MySQL
Note that this value is not cached, and is not transactionnal on MySQL
side.
side.
"""
"""
return
db
.
query
(
"SELECT UTC_TIMESTAMP(6)"
,
0
)[
1
][
0
][
0
]
return
db
.
query
(
b
"SELECT UTC_TIMESTAMP(6)"
,
0
)[
1
][
0
][
0
]
class
SQLBase
(
Queue
):
class
SQLBase
(
Queue
):
"""
"""
...
@@ -831,8 +831,8 @@ CREATE TABLE %s (
...
@@ -831,8 +831,8 @@ CREATE TABLE %s (
"""
"""
Put messages back in given processing_node.
Put messages back in given processing_node.
"""
"""
db
.
query
(
"UPDATE %s SET processing_node=%s WHERE uid IN (%s)
\
0
COMMIT"
%
(
db
.
query
(
(
"UPDATE %s SET processing_node=%s WHERE uid IN (%s)
\
0
COMMIT"
%
(
self
.
sql_table
,
state
,
','
.
join
(
map
(
str
,
uid_list
))))
self
.
sql_table
,
state
,
','
.
join
(
map
(
str
,
uid_list
))))
.
encode
())
def
getProcessableMessageLoader
(
self
,
db
,
processing_node
):
def
getProcessableMessageLoader
(
self
,
db
,
processing_node
):
# do not merge anything
# do not merge anything
...
...
product/CMFActivity/tests/testCMFActivity.py
View file @
d56cc014
...
@@ -619,7 +619,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
...
@@ -619,7 +619,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
# Monkey patch Queue to induce conflict errors artificially.
# Monkey patch Queue to induce conflict errors artificially.
def
query
(
self
,
query_string
,
*
args
,
**
kw
):
def
query
(
self
,
query_string
,
*
args
,
**
kw
):
# Not so nice, this is specific to zsql method
# Not so nice, this is specific to zsql method
if
"REPLACE INTO"
in
query_string
:
if
b
"REPLACE INTO"
in
query_string
:
raise
OperationalError
raise
OperationalError
return
self
.
original_query
(
query_string
,
*
args
,
**
kw
)
return
self
.
original_query
(
query_string
,
*
args
,
**
kw
)
...
@@ -1026,7 +1026,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
...
@@ -1026,7 +1026,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
"""
"""
activity_tool
=
self
.
getActivityTool
()
activity_tool
=
self
.
getActivityTool
()
def
delete_volatiles
():
def
delete_volatiles
():
for
property_id
in
activity_tool
.
__dict__
.
keys
(
):
for
property_id
in
list
(
six
.
iterkeys
(
activity_tool
.
__dict__
)
):
if
property_id
.
startswith
(
'_v_'
):
if
property_id
.
startswith
(
'_v_'
):
delattr
(
activity_tool
,
property_id
)
delattr
(
activity_tool
,
property_id
)
organisation_module
=
self
.
getOrganisationModule
()
organisation_module
=
self
.
getOrganisationModule
()
...
@@ -1142,6 +1142,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
...
@@ -1142,6 +1142,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
self
.
flushAllActivities
(
silent
=
1
,
loop_size
=
100
)
self
.
flushAllActivities
(
silent
=
1
,
loop_size
=
100
)
# Check there is a traceback in the email notification
# Check there is a traceback in the email notification
sender
,
recipients
,
mail
=
message_list
.
pop
()
sender
,
recipients
,
mail
=
message_list
.
pop
()
mail
=
mail
.
decode
()
self
.
assertIn
(
"Module %s, line %s, in failingMethod"
%
(
self
.
assertIn
(
"Module %s, line %s, in failingMethod"
%
(
__name__
,
inspect
.
getsourcelines
(
failingMethod
)[
1
]),
mail
)
__name__
,
inspect
.
getsourcelines
(
failingMethod
)[
1
]),
mail
)
self
.
assertIn
(
"ValueError:"
,
mail
)
self
.
assertIn
(
"ValueError:"
,
mail
)
...
@@ -1894,7 +1895,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
...
@@ -1894,7 +1895,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
"""
"""
original_query
=
six
.
get_unbound_function
(
DB
.
query
)
original_query
=
six
.
get_unbound_function
(
DB
.
query
)
def
query
(
self
,
query_string
,
*
args
,
**
kw
):
def
query
(
self
,
query_string
,
*
args
,
**
kw
):
if
query_string
.
startswith
(
'INSERT'
):
if
query_string
.
startswith
(
b
'INSERT'
):
insert_list
.
append
(
len
(
query_string
))
insert_list
.
append
(
len
(
query_string
))
if
not
n
:
if
not
n
:
raise
Skip
raise
Skip
...
@@ -2490,7 +2491,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
...
@@ -2490,7 +2491,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
self
.
assertEqual
(
1
,
activity_tool
.
countMessage
())
self
.
assertEqual
(
1
,
activity_tool
.
countMessage
())
self
.
flushAllActivities
()
self
.
flushAllActivities
()
sender
,
recipients
,
mail
=
message_list
.
pop
()
sender
,
recipients
,
mail
=
message_list
.
pop
()
self
.
assertIn
(
'UID mismatch'
,
mail
)
self
.
assertIn
(
b
'UID mismatch'
,
mail
)
m
,
=
activity_tool
.
getMessageList
()
m
,
=
activity_tool
.
getMessageList
()
self
.
assertEqual
(
m
.
processing_node
,
INVOKE_ERROR_STATE
)
self
.
assertEqual
(
m
.
processing_node
,
INVOKE_ERROR_STATE
)
obj
.
flushActivity
()
obj
.
flushActivity
()
...
...
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