]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix sleep function call
authorSamer Deeb <samerd@mellanox.com>
Wed, 1 Oct 2014 06:55:21 +0000 (09:55 +0300)
committerSamer Deeb <samerd@mellanox.com>
Tue, 4 Nov 2014 11:44:52 +0000 (11:44 +0000)
Remove time.sleep method reference in class and use time.sleep directly.

Change-Id: Ib4c02061b29c0d584d603746a78ab50922f781c3
Closes-Bug: 1375698
(cherry picked from commit 8e36ba8d24c198cb5e6c0e4ddc29a08904e3e10c)

neutron/plugins/mlnx/common/comm_utils.py
neutron/tests/unit/mlnx/test_mlnx_comm_utils.py

index 834b5a2cb1237acb163dd6d713a037b7ab351382..f426908f282498a02cb060bdc123374268ab0fff 100644 (file)
@@ -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
 
index bb8bdcced713875d2a228ea69e390870d060dcb3..49f2eaceea7b0597a9c70922184f4d038899c47e 100644 (file)
@@ -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):