summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdward MacGillivray <edward.s.macgillivray@intel.com>2017-09-15 16:45:41 -0700
committerEdward MacGillivray <edward.s.macgillivray@intel.com>2017-09-26 20:03:04 +0000
commit3de95504a9a329cefcdec2ea9508709118bbf94e (patch)
tree246df74d6323ec4e00207a5f02dbb57674774ce3 /tests
parentc84187fc404d44082826f98b47c28d3d8f6690e5 (diff)
Ensure that at least one handler is available
https://jira.opnfv.org/browse/YARDSTICK-773?filter=-3 Remove dependency of yardstick on utils methods Change-Id: Iadf502364a7f08c279a8f0d17d7e45e8047f4066 Signed-off-by: Edward MacGillivray <edward.s.macgillivray@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/common/test_utils.py16
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