From: Brian Warner Date: Tue, 30 Sep 2008 05:23:09 +0000 (-0700) Subject: testutil.PollMixin: set default timeout (to 100s), emit a more helpful error when... X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/rgr-080307.php?a=commitdiff_plain;h=1e3500ae5fcb60fdf8d68474e37396422efe740c;p=tahoe-lafs%2Ftahoe-lafs.git testutil.PollMixin: set default timeout (to 100s), emit a more helpful error when the timeout is hit --- 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()