:param retries: number of times to try before giving up
:raises: exceptionToCheck
"""
- sleep_fn = time.sleep
def __init__(self, exceptionToCheck,
interval=cfg.CONF.ESWITCH.request_timeout / 1000,
except self.exc:
LOG.debug(_("Request timeout - call again after "
"%s seconds"), sleep_interval)
- RetryDecorator.sleep_fn(sleep_interval)
+ time.sleep(sleep_interval)
num_of_iter -= 1
sleep_interval *= self.backoff_rate
class TestRetryDecorator(base.BaseTestCase):
def setUp(self):
super(TestRetryDecorator, self).setUp()
- self.sleep_fn_p = mock.patch.object(comm_utils.RetryDecorator,
- 'sleep_fn')
+ self.sleep_fn_p = mock.patch("time.sleep")
self.sleep_fn = self.sleep_fn_p.start()
def test_no_retry_required(self):