From c2968770a5254ebdad9b8a9a4b8ad289448a47a4 Mon Sep 17 00:00:00 2001 From: Ivan Kolodyazhny Date: Wed, 7 Sep 2016 12:46:28 +0300 Subject: [PATCH] Mock time.sleep for test_lv_deactivate_timeout test Test local_dev.test_brick_lvm.BrickLvmTestCase.test_lv_deactivate_timeout doesn't mock time.sleep which is used for retries. It increases test execution time to ~2s instead of ~0.02. Change-Id: Id3704d90de0b3d04401c0b7b7686470685dbc1cc Closes-Bug: #1620986 --- os_brick/tests/local_dev/test_brick_lvm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/os_brick/tests/local_dev/test_brick_lvm.py b/os_brick/tests/local_dev/test_brick_lvm.py index 17d1edecb..6d8dc99d7 100644 --- a/os_brick/tests/local_dev/test_brick_lvm.py +++ b/os_brick/tests/local_dev/test_brick_lvm.py @@ -373,7 +373,8 @@ class BrickLvmTestCase(base.TestCase): self.vg.create_volume('test', '1G') self.vg.deactivate_lv('test') - def test_lv_deactivate_timeout(self): + @mock.patch('time.sleep') + def test_lv_deactivate_timeout(self, mock_sleep): with mock.patch.object(self.vg, '_execute'): is_active_mock = mock.Mock() is_active_mock.return_value = True