diff options
Diffstat (limited to 'tests/unit/common/test_utils.py')
-rw-r--r-- | tests/unit/common/test_utils.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unit/common/test_utils.py b/tests/unit/common/test_utils.py index 923ec4aaa..42b75d1f0 100644 --- a/tests/unit/common/test_utils.py +++ b/tests/unit/common/test_utils.py @@ -17,6 +17,7 @@ import unittest from copy import deepcopy from itertools import product, chain +import errno import mock from six.moves import configparser @@ -780,6 +781,21 @@ class RemoveFileTestCase(unittest.TestCase): class TestUtils(unittest.TestCase): + @mock.patch('yardstick.common.utils.os.makedirs') + def test_makedirs(self, *_): + self.assertIsNone(utils.makedirs('a/b/c/d')) + + @mock.patch('yardstick.common.utils.os.makedirs') + def test_makedirs_exists(self, mock_os_makedirs): + mock_os_makedirs.side_effect = OSError(errno.EEXIST, 'exists') + self.assertIsNone(utils.makedirs('a/b/c/d')) + + @mock.patch('yardstick.common.utils.os.makedirs') + def test_makedirs_busy(self, mock_os_makedirs): + mock_os_makedirs.side_effect = OSError(errno.EBUSY, 'busy') + with self.assertRaises(OSError): + utils.makedirs('a/b/c/d') + @mock.patch('yardstick.common.utils.jsonify') def test_result_handler(self, mock_jsonify): mock_jsonify.return_value = 432 |