Allow to specify how log to sleep between attempts in wait_until
This commit is contained in:
parent
3c99d9e358
commit
91af72b18f
@ -1226,7 +1226,7 @@ class msg_reject(object):
|
||||
% (self.message, self.code, self.reason, self.data)
|
||||
|
||||
# Helper function
|
||||
def wait_until(predicate, *, attempts=float('inf'), timeout=float('inf')):
|
||||
def wait_until(predicate, *, attempts=float('inf'), timeout=float('inf'), sleep=0.05):
|
||||
attempt = 0
|
||||
elapsed = 0
|
||||
|
||||
@ -1235,8 +1235,8 @@ def wait_until(predicate, *, attempts=float('inf'), timeout=float('inf')):
|
||||
if predicate():
|
||||
return True
|
||||
attempt += 1
|
||||
elapsed += 0.05
|
||||
time.sleep(0.05)
|
||||
elapsed += sleep
|
||||
time.sleep(sleep)
|
||||
|
||||
return False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user