diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-10-03 17:56:25 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-10-03 17:56:25 +0000 |
commit | dd57115618caa299f6dd1eb350b55ecf062ca92e (patch) | |
tree | 69294b88cbae3f7cd8e9b5ac1c9120196a8b1329 /tests/unit | |
parent | e8cf6a76c346806b53fa0c802374327ddc4956d1 (diff) | |
parent | 3de95504a9a329cefcdec2ea9508709118bbf94e (diff) |
Merge "Ensure that at least one handler is available"
Diffstat (limited to 'tests/unit')
-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 |