aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/benchmark
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-06-28 17:17:08 +0100
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-06-29 10:44:00 +0000
commit4bf3b18f921b7bc7ecf3d34cb74fd80176cae8d5 (patch)
treeb0e52c39420f83718e892fd19ad8b41b3b3be788 /yardstick/tests/unit/benchmark
parent6f4db35421d258cebd6e01769037e5cd64115639 (diff)
Move "read_yaml_file" to common.yaml_loader
JIRA: YARDSTICK-1265 Change-Id: Ic2813dca7fc9a3230632f6e8bd75aeacc7e951b0 Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/tests/unit/benchmark')
-rw-r--r--yardstick/tests/unit/benchmark/contexts/test_base.py3
-rw-r--r--yardstick/tests/unit/benchmark/contexts/test_heat.py8
-rw-r--r--yardstick/tests/unit/benchmark/contexts/test_node.py8
3 files changed, 12 insertions, 7 deletions
diff --git a/yardstick/tests/unit/benchmark/contexts/test_base.py b/yardstick/tests/unit/benchmark/contexts/test_base.py
index 8f1cbcc55..64499cf14 100644
--- a/yardstick/tests/unit/benchmark/contexts/test_base.py
+++ b/yardstick/tests/unit/benchmark/contexts/test_base.py
@@ -19,6 +19,7 @@ import mock
from yardstick.benchmark.contexts import base
from yardstick.benchmark.contexts.base import Context
+from yardstick.common import yaml_loader
from yardstick.tests.unit import base as ut_base
from yardstick.common.constants import YARDSTICK_ROOT_PATH
@@ -129,7 +130,7 @@ class ContextTestCase(ut_base.BaseUnitTestCase):
mock_get_ctx.assert_called_once()
self.assertIsNone(result)
- @mock.patch('yardstick.common.utils.read_yaml_file')
+ @mock.patch.object(yaml_loader, 'read_yaml_file')
def test_read_pod_file(self, mock_read_yaml_file):
attrs = {'name': 'foo',
'task_id': '12345678',
diff --git a/yardstick/tests/unit/benchmark/contexts/test_heat.py b/yardstick/tests/unit/benchmark/contexts/test_heat.py
index 7605ef29a..7782d96bd 100644
--- a/yardstick/tests/unit/benchmark/contexts/test_heat.py
+++ b/yardstick/tests/unit/benchmark/contexts/test_heat.py
@@ -20,6 +20,7 @@ from yardstick.benchmark.contexts import model
from yardstick.common import constants as consts
from yardstick.common import exceptions as y_exc
from yardstick.common import openstack_utils
+from yardstick.common import yaml_loader
from yardstick import ssh
@@ -80,12 +81,13 @@ class HeatContextTestCase(unittest.TestCase):
self.assertIsNone(self.test_context.heat_parameters)
self.assertIsNone(self.test_context.key_filename)
- @mock.patch('yardstick.common.utils.read_yaml_file')
+ @mock.patch.object(yaml_loader, 'read_yaml_file')
@mock.patch('yardstick.benchmark.contexts.heat.PlacementGroup')
@mock.patch('yardstick.benchmark.contexts.heat.ServerGroup')
@mock.patch('yardstick.benchmark.contexts.heat.Network')
@mock.patch('yardstick.benchmark.contexts.heat.Server')
- def test_init(self, mock_server, mock_network, mock_sg, mock_pg, mock_read_yaml):
+ def test_init(self, mock_server, mock_network, mock_sg, mock_pg,
+ mock_read_yaml):
mock_read_yaml.return_value = self.HEAT_POD_SAMPLE
pgs = {'pgrp1': {'policy': 'availability'}}
@@ -764,7 +766,7 @@ class HeatContextTestCase(unittest.TestCase):
nodes = self.test_context._get_physical_nodes()
self.assertEquals(nodes, {})
- @mock.patch('yardstick.common.utils.read_yaml_file')
+ @mock.patch.object(yaml_loader, 'read_yaml_file')
def test__get_physical_node_for_server(self, mock_read_yaml):
attrs = {'name': 'foo',
'task_id': '12345678',
diff --git a/yardstick/tests/unit/benchmark/contexts/test_node.py b/yardstick/tests/unit/benchmark/contexts/test_node.py
index 5d7b24c3d..4c8d3d1d8 100644
--- a/yardstick/tests/unit/benchmark/contexts/test_node.py
+++ b/yardstick/tests/unit/benchmark/contexts/test_node.py
@@ -8,14 +8,16 @@
##############################################################################
import os
-import unittest
import errno
+
import mock
+import unittest
-from yardstick.common import constants as consts
from yardstick.benchmark.contexts import base
from yardstick.benchmark.contexts import node
+from yardstick.common import constants as consts
from yardstick.common import exceptions
+from yardstick.common import yaml_loader
class NodeContextTestCase(unittest.TestCase):
@@ -56,7 +58,7 @@ class NodeContextTestCase(unittest.TestCase):
self.assertEqual(self.test_context.env, {})
self.assertEqual(self.test_context.attrs, {})
- @mock.patch('yardstick.common.utils.read_yaml_file')
+ @mock.patch.object(yaml_loader, 'read_yaml_file')
@mock.patch('{}.os.path.join'.format(PREFIX))
def test_init_negative(self, mock_path_join, read_mock):
special_path = '/foo/bar/error_file'