From 8c7fa412be54ee2947d5c19a54dd4f050f3f07cb Mon Sep 17 00:00:00 2001 From: Rodrigo Barbieri Date: Fri, 10 Feb 2017 09:27:45 -0200 Subject: [PATCH] Mock time.sleep in tests that sleep Tests that retry or sleep take longer when running unit tests suite, so, mock time.sleep to save time. TrivialFix Change-Id: Ie2e790dc26015d57c84f5a6b9777ee060dc1b820 --- manila/tests/data/test_utils.py | 2 ++ .../share/drivers/dell_emc/plugins/vnx/test_object_manager.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/manila/tests/data/test_utils.py b/manila/tests/data/test_utils.py index 8fea9cca33..835205193c 100644 --- a/manila/tests/data/test_utils.py +++ b/manila/tests/data/test_utils.py @@ -14,6 +14,7 @@ # under the License. import os +import time import mock @@ -208,6 +209,7 @@ class CopyClassTestCase(test.TestCase): self.mock_object(utils, 'execute', mock.Mock( side_effect=get_output)) self.mock_object(self._copy, 'get_progress') + self.mock_object(time, 'sleep') # run self._copy.copy_data(self._copy.src) diff --git a/manila/tests/share/drivers/dell_emc/plugins/vnx/test_object_manager.py b/manila/tests/share/drivers/dell_emc/plugins/vnx/test_object_manager.py index 03d895d8df..2a302cc4ba 100644 --- a/manila/tests/share/drivers/dell_emc/plugins/vnx/test_object_manager.py +++ b/manila/tests/share/drivers/dell_emc/plugins/vnx/test_object_manager.py @@ -14,6 +14,7 @@ # under the License. import copy +import time import ddt from lxml import builder @@ -111,6 +112,7 @@ class StorageObjectTestCase(StorageObjectTestCaseBase): fake_req = storage_object._build_task_package( elt_maker.StartFake(name='foo') ) + self.mock_object(time, 'sleep') resp = storage_object._send_request(fake_req) self.assertEqual('ok', resp['maxSeverity'])