From 1e3500ae5fcb60fdf8d68474e37396422efe740c Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 29 Sep 2008 22:23:09 -0700 Subject: [PATCH] testutil.PollMixin: set default timeout (to 100s), emit a more helpful error when the timeout is hit --- src/allmydata/util/testutil.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/allmydata/util/testutil.py b/src/allmydata/util/testutil.py index c43b1219..7ca6f4c3 100644 --- a/src/allmydata/util/testutil.py +++ b/src/allmydata/util/testutil.py @@ -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() -- 2.45.2