mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +00:00
tests: Reduce time for polling in functional tests
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
c83a3cd22e
commit
a214e64175
@ -49,13 +49,14 @@ def is_not_running(browser, service_name):
|
|||||||
def eventually(function, args=[], timeout=30):
|
def eventually(function, args=[], timeout=30):
|
||||||
"""Execute a function returning a boolean expression till it returns
|
"""Execute a function returning a boolean expression till it returns
|
||||||
True or a timeout is reached"""
|
True or a timeout is reached"""
|
||||||
counter = 1
|
waited_time = 0
|
||||||
while counter < timeout:
|
while waited_time < timeout:
|
||||||
if function(*args):
|
if function(*args):
|
||||||
return True
|
return True
|
||||||
else:
|
|
||||||
counter += 1
|
sleep(0.1)
|
||||||
sleep(1)
|
waited_time += 0.1
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user