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
89f88918
Commit
89f88918
authored
Mar 22, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testBusinessTemplate: cancel failed activites at end of test
parent
f986931b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
...eItem/portal_components/test.erp5.testBusinessTemplate.py
+25
-0
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
View file @
89f88918
...
...
@@ -36,6 +36,7 @@ from Acquisition import aq_base
from
App.config
import
getConfiguration
from
Products.ERP5Type.tests.Sequence
import
SequenceList
,
Sequence
from
six.moves.urllib.request
import
pathname2url
from
Testing
import
ZopeTestCase
from
Products.ERP5Type.Globals
import
PersistentMapping
from
Products.ERP5Type.dynamic.lazy_class
import
ERP5BaseBroken
from
Products.ERP5Type.tests.utils
import
LogInterceptor
...
...
@@ -203,6 +204,30 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
property_sheet_tool
.
manage_delObjects
([
property_sheet
])
self
.
commit
()
self
.
_ignore_log_errors
()
self
.
cancelFailedActivities
()
def
cancelFailedActivities
(
self
):
"""Cancel failed activities and mark this test as failed if there was any.
We do this because we don't want a test which did not fail but left failing
activities to succeed. Test which failed and also left failing activities
will count as 2 failures, so with this method it may happen that the number
of failures is higher than the number of tests.
"""
self
.
abort
()
try
:
self
.
tic
()
except
RuntimeError
:
# "tic is running forever"
activity_tool
=
self
.
portal
.
portal_activities
for
message
in
activity_tool
.
getMessageList
():
activity_tool
.
manageDelete
(
message
.
uid
,
message
.
activity
)
ZopeTestCase
.
_print
(
'
\
n
Cancelling active message %s/%s
\
n
'
%
(
'/'
.
join
(
message
.
object_path
),
message
.
method_id
)
)
self
.
commit
()
# if activity failed, it's most probably because of broken components,
# so try to reset to not leave broken components for next tests
self
.
portal
.
portal_components
.
reset
(
force
=
True
)
self
.
fail
(
"A previous Tic failed"
)
def
getBusinessTemplate
(
self
,
title
):
"""
...
...
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