mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 21:17:54 +00:00
testutil.PollMixin: set default timeout (to 100s), emit a more helpful error when the timeout is hit
This commit is contained in:
parent
2e8b89e9e4
commit
1e3500ae5f
@ -46,7 +46,7 @@ class PollComplete(Exception):
|
||||
|
||||
class PollMixin:
|
||||
|
||||
def poll(self, check_f, pollinterval=0.01, timeout=None):
|
||||
def poll(self, check_f, pollinterval=0.01, timeout=100):
|
||||
# Return a Deferred, then call check_f periodically until it returns
|
||||
# True, at which point the Deferred will fire.. If check_f raises an
|
||||
# exception, the Deferred will errback. If the check_f does not
|
||||
@ -66,7 +66,7 @@ class PollMixin:
|
||||
|
||||
def _poll(self, check_f, cutoff):
|
||||
if cutoff is not None and time.time() > cutoff:
|
||||
raise TimeoutError()
|
||||
raise TimeoutError("PollMixin never saw %s return True" % check_f)
|
||||
if check_f():
|
||||
raise PollComplete()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user