Commit e18266a2 authored by Julien Muchembled's avatar Julien Muchembled

Make functional tests stop waiting for activities as soon as they're all in failed state

parent e2fa25fc
from time import sleep
def waitForActivities(self, count=1000):
"""
We wait until all activities are finished
RuntimeError is raised in case there is no way
to finish activities.
"""
activity_tool = self.getPortalObject().portal_activities
for x in xrange(count):
x = activity_tool.getMessageList()
if not x:
return 'Done.'
if all(x.processing_node == -2 for x in x):
break
activity_tool.process_timer(None, None)
sleep(1)
raise RuntimeError('tic is looping forever.')
def UpdateImage(image):
image._update_image_info()
......
"""
We wait until all activities are finished
RuntimeError is raised in case there is no way
to finish activities.
"""
from Products.ERP5Type.Utils import sleep
count = int(count)
while len(context.portal_activities.getMessageList()) > 0:
context.portal_activities.process_timer(0, 0)
count -= 1
sleep(t=1)
if count < 0:
raise RuntimeError, 'tic is endless'
return 'Done.'
......@@ -2,63 +2,17 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
<key> <string>_function</string> </key>
<value> <string>waitForActivities</string> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>count = 1000</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
<key> <string>_module</string> </key>
<value> <string>ERP5Zuite</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment