X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Ftests%2Funit%2Fcommon%2Ftest_utils.py;h=d077d8880104424aef48241798cd439fb55ba80e;hb=8068adbf0aa5275f9c4cd4e298f1868834242e9a;hp=666b29b5fb23c54f5c780fa4e9cc57f076e76c2d;hpb=b05c13458ce6afef1171cd8463b7053e489d0497;p=yardstick.git diff --git a/yardstick/tests/unit/common/test_utils.py b/yardstick/tests/unit/common/test_utils.py index 666b29b5f..d077d8880 100644 --- a/yardstick/tests/unit/common/test_utils.py +++ b/yardstick/tests/unit/common/test_utils.py @@ -895,7 +895,7 @@ class TestUtils(unittest.TestCase): os.environ.clear() os.environ.update(base_env) - @mock.patch('yardstick.common.utils.configparser.ConfigParser') + @mock.patch.object(configparser, 'ConfigParser') def test_parse_ini_file(self, mock_config_parser_type): defaults = { 'default1': 'value1', @@ -927,23 +927,26 @@ class TestUtils(unittest.TestCase): result = utils.parse_ini_file('my_path') self.assertDictEqual(result, expected) - @mock.patch('yardstick.common.utils.configparser.ConfigParser') - def test_parse_ini_file_missing_section_header(self, mock_config_parser_type): + @mock.patch.object(utils, 'logger') + @mock.patch.object(configparser, 'ConfigParser') + def test_parse_ini_file_missing_section_header( + self, mock_config_parser_type, *args): mock_config_parser = mock_config_parser_type() - mock_config_parser.read.side_effect = \ - configparser.MissingSectionHeaderError(mock.Mock(), 321, mock.Mock()) + mock_config_parser.read.side_effect = ( + configparser.MissingSectionHeaderError(mock.Mock(), 321, + mock.Mock())) with self.assertRaises(configparser.MissingSectionHeaderError): utils.parse_ini_file('my_path') - @mock.patch('yardstick.common.utils.configparser.ConfigParser') + @mock.patch.object(configparser, 'ConfigParser') def test_parse_ini_file_no_file(self, mock_config_parser_type): mock_config_parser = mock_config_parser_type() mock_config_parser.read.return_value = False with self.assertRaises(RuntimeError): utils.parse_ini_file('my_path') - @mock.patch('yardstick.common.utils.configparser.ConfigParser') + @mock.patch.object(configparser, 'ConfigParser') def test_parse_ini_file_no_default_section_header(self, mock_config_parser_type): s1 = { 'key1': 'value11',