X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Funit%2Fbenchmark%2Fcore%2Ftest_plugin.py;h=f9c076159b2f7c4cc72018fa4df3db19aa8d2524;hb=07249e010dd9837d63f3090f1eac0fc6763b968f;hp=441116a2513ebbace932f746a06dc3481d2794d2;hpb=45db0fdabb4585b96756a390650181a3c46facf7;p=yardstick.git diff --git a/tests/unit/benchmark/core/test_plugin.py b/tests/unit/benchmark/core/test_plugin.py index 441116a25..f9c076159 100644 --- a/tests/unit/benchmark/core/test_plugin.py +++ b/tests/unit/benchmark/core/test_plugin.py @@ -10,16 +10,27 @@ ############################################################################## # Unittest for yardstick.benchmark.core.plugin - -import mock +from __future__ import absolute_import +import os +from os.path import dirname as dirname + +try: + from unittest import mock +except ImportError: + import mock import unittest from yardstick.benchmark.core import plugin class Arg(object): + def __init__(self): - self.input_file = ('plugin/sample_config.yaml',) + # self.input_file = ('plugin/sample_config.yaml',) + self.input_file = [ + os.path.join(os.path.abspath( + dirname(dirname(dirname(dirname(dirname(__file__)))))), + 'plugin/sample_config.yaml')] @mock.patch('yardstick.benchmark.core.plugin.ssh') @@ -30,7 +41,7 @@ class pluginTestCase(unittest.TestCase): def test_install(self, mock_ssh): p = plugin.Plugin() - mock_ssh.SSH().execute.return_value = (0, '', '') + mock_ssh.SSH.from_node().execute.return_value = (0, '', '') input_file = Arg() p.install(input_file) expected_result = {} @@ -38,7 +49,7 @@ class pluginTestCase(unittest.TestCase): def test_remove(self, mock_ssh): p = plugin.Plugin() - mock_ssh.SSH().execute.return_value = (0, '', '') + mock_ssh.SSH.from_node().execute.return_value = (0, '', '') input_file = Arg() p.remove(input_file) expected_result = {} @@ -46,7 +57,7 @@ class pluginTestCase(unittest.TestCase): def test_install_setup_run(self, mock_ssh): p = plugin.Plugin() - mock_ssh.SSH().execute.return_value = (0, '', '') + mock_ssh.SSH.from_node().execute.return_value = (0, '', '') plugins = { "name": "sample" } @@ -65,7 +76,7 @@ class pluginTestCase(unittest.TestCase): def test_remove_setup_run(self, mock_ssh): p = plugin.Plugin() - mock_ssh.SSH().execute.return_value = (0, '', '') + mock_ssh.SSH.from_node().execute.return_value = (0, '', '') plugins = { "name": "sample" }