Commit 494f871f authored by Jérome Perrin's avatar Jérome Perrin

ui_test_core: shift time in Zuite_waitForActivities

For consistency with ERP5TypeTestCase.tic for server side unit test, use
timeShift to simulate a progress in time so that activities scheduled
for executation at a later time ( using activate(at_date=...) ) are
executed.
parent 75b39618
from Products.CMFActivity.Activity.Queue import VALIDATION_ERROR_DELAY
def waitForActivities(self, count=1000): def waitForActivities(self, count=1000):
""" """
...@@ -7,13 +8,16 @@ def waitForActivities(self, count=1000): ...@@ -7,13 +8,16 @@ def waitForActivities(self, count=1000):
to finish activities. to finish activities.
""" """
activity_tool = self.getPortalObject().portal_activities activity_tool = self.getPortalObject().portal_activities
for x in xrange(count): while count > 0:
count -= 1
x = activity_tool.getMessageList() x = activity_tool.getMessageList()
if not x: if not x:
return 'Done.' return 'Done.'
if all(x.processing_node == -2 for x in x): if all(x.processing_node == -2 for x in x):
break break
activity_tool.process_timer(None, None) activity_tool.process_timer(None, None)
if count % 10 == 0:
activity_tool.timeShift(3 * VALIDATION_ERROR_DELAY)
raise RuntimeError('tic is looping forever.') raise RuntimeError('tic is looping forever.')
def UpdateImage(image): def UpdateImage(image):
......
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