Commit 6e7fdd72 authored by Jérome Perrin's avatar Jérome Perrin

testCacheTool: use time.sleep to simulate an expensive computation

nowadays we can use time.sleep in restricted python
parent a64a94e8
...@@ -368,13 +368,9 @@ return result ...@@ -368,13 +368,9 @@ return result
py_script_obj = getattr(portal, python_script_id) py_script_obj = getattr(portal, python_script_id)
py_script_params = "value=10000, long_parameter=''" py_script_params = "value=10000, long_parameter=''"
py_script_body = """ py_script_body = """
import time
def veryExpensiveMethod(value): def veryExpensiveMethod(value):
# do something expensive for some time time.sleep(1)
# no 'time.sleep()' available in Zope
# so concatenate strings
s = ''
for i in range(0, value):
s = str(value * value * value) + s
return value return value
veryExpensiveMethod(value) veryExpensiveMethod(value)
......
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