From f9ae768811fda1a1ac0c1d40b74bb73c416dae52 Mon Sep 17 00:00:00 2001 From: John Griffith Date: Mon, 14 Jul 2014 17:10:18 -0600 Subject: [PATCH] Mock out time.sleep in storwize unit tests The Storwize driver has issues that required them to add a sleep 1 on init of the driver. No big deal, but causes unit tests to take a very long time waiting for the "time.sleep(1)" on every single unit test that calls init. This patch just mocks out the time.sleep so we don't have to do the silly waiting in unit tests. Change-Id: I10fc3d00252a7e7b90085cb308fb9c6c7e1f5ea7 --- cinder/tests/test_storwize_svc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cinder/tests/test_storwize_svc.py b/cinder/tests/test_storwize_svc.py index 375594a09..6ac732c12 100644 --- a/cinder/tests/test_storwize_svc.py +++ b/cinder/tests/test_storwize_svc.py @@ -21,6 +21,7 @@ Tests for the IBM Storwize family and SVC volume driver. import mock import random import re +import time from cinder import context from cinder import exception @@ -1455,7 +1456,8 @@ class StorwizeSVCFakeDriver(storwize_svc.StorwizeSVCDriver): class StorwizeSVCDriverTestCase(test.TestCase): - def setUp(self): + @mock.patch.object(time, 'sleep') + def setUp(self, mock_sleep): super(StorwizeSVCDriverTestCase, self).setUp() self.USESIM = True if self.USESIM: -- 2.45.2