]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
testutil.PollMixin: set default timeout (to 100s), emit a more helpful error when...
authorBrian Warner <warner@allmydata.com>
Tue, 30 Sep 2008 05:23:09 +0000 (22:23 -0700)
committerBrian Warner <warner@allmydata.com>
Tue, 30 Sep 2008 05:23:09 +0000 (22:23 -0700)
src/allmydata/util/testutil.py

index c43b1219dfef6b25677f627e80cbeb7ec36b7099..7ca6f4c3af3ab305412b1c7e32e443af8b0a557d 100644 (file)
@@ -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()