Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

bug 685673: increase default sleep time in util/ r=catlee/rail

  • Loading branch information...
commit 2e9be799e8a60879c9ca15c7bb9a20b87fe62658 1 parent 70a09de
@bhearsum bhearsum authored
9 lib/python/buildtools/test/
@@ -37,7 +37,7 @@ def setUp(self):
def testRetrySucceed(self):
# Will raise if anything goes wrong
- retry(_succeedOnSecondAttempt, attempts=2)
+ retry(_succeedOnSecondAttempt, attempts=2, sleeptime=0)
def testRetryFailWithoutCatching(self):
self.assertRaises(Exception, retry, _alwaysFail, exceptions=())
@@ -46,11 +46,12 @@ def testRetryFailEnsureRaisesLastException(self):
self.assertRaises(Exception, retry, _alwaysFail)
def testRetrySelectiveExceptionSucceed(self):
- retry(_raiseCustomException, attempts=2, retry_exceptions=(NewError,))
+ retry(_raiseCustomException, attempts=2, sleeptime=0,
+ retry_exceptions=(NewError,))
def testRetrySelectiveExceptionFail(self):
self.assertRaises(NewError, retry, _raiseCustomException, attempts=2,
- retry_exceptions=(OtherError,))
+ sleeptime=0, retry_exceptions=(OtherError,))
# TODO: figure out a way to test that the sleep actually happened
def testRetryWithSleep(self):
@@ -69,5 +70,5 @@ def testRetryReturns(self):
def testRetryCleanupIsCalled(self):
cleanup = mock.Mock()
- retry(_succeedOnSecondAttempt, cleanup=cleanup)
+ retry(_succeedOnSecondAttempt, cleanup=cleanup, sleeptime=0)
self.assertEquals(cleanup.call_count, 1)
2  lib/python/util/
@@ -3,7 +3,7 @@
import logging
log = logging.getLogger(__name__)
-def retry(action, attempts=5, sleeptime=0, retry_exceptions=(Exception,),
+def retry(action, attempts=5, sleeptime=60, retry_exceptions=(Exception,),
cleanup=None, args=(), kwargs={}):
"""Call `action' a maximum of `attempts' times until it succeeds,
defaulting to 5. `sleeptime' is the number of seconds to wait
Please sign in to comment.
Something went wrong with that request. Please try again.