summaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorEdward MacGillivray <edward.s.macgillivray@intel.com>2017-09-15 16:45:41 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-10-03 11:00:07 -0700
commitbb9a5d2d6dcff286df4a7dbc601b6d777abeed6a (patch)
tree989d1a25f1b5e8a3e5f65846e4eb7894f3aea0d7 /tests/unit
parent865dd398b8bc0e37f795c754b7f28660eb853d09 (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/unit')
-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