From: Samer Deeb Date: Wed, 1 Oct 2014 06:55:21 +0000 (+0300) Subject: Fix sleep function call X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ee9c51db50621e92ce7261d60b0eaf3f20498b84;p=openstack-build%2Fneutron-build.git Fix sleep function call Remove time.sleep method reference in class and use time.sleep directly. Change-Id: Ib4c02061b29c0d584d603746a78ab50922f781c3 Closes-Bug: 1375698 (cherry picked from commit 8e36ba8d24c198cb5e6c0e4ddc29a08904e3e10c) --- diff --git a/neutron/plugins/mlnx/common/comm_utils.py b/neutron/plugins/mlnx/common/comm_utils.py index 834b5a2cb..f426908f2 100644 --- a/neutron/plugins/mlnx/common/comm_utils.py +++ b/neutron/plugins/mlnx/common/comm_utils.py @@ -35,7 +35,6 @@ class RetryDecorator(object): :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, @@ -56,7 +55,7 @@ class RetryDecorator(object): 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 diff --git a/neutron/tests/unit/mlnx/test_mlnx_comm_utils.py b/neutron/tests/unit/mlnx/test_mlnx_comm_utils.py index bb8bdcced..49f2eacee 100644 --- a/neutron/tests/unit/mlnx/test_mlnx_comm_utils.py +++ b/neutron/tests/unit/mlnx/test_mlnx_comm_utils.py @@ -29,8 +29,7 @@ class WrongException(Exception): 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):