summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-06-25 14:40:34 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-06-25 14:40:34 +0000
commitdbdd0a395616495b41d35d904fb5fb4da4544d26 (patch)
treec75cf567a1ca78b6e1d03a2912191a7b094aec42
parent16ed2f0614b4fa4ab2aed5062233a28ff6a0a8e0 (diff)
parentca5ecd0322c8f905807613608555f75cdc50feb8 (diff)
Merge "Remove print out of logger exception in TestUtils" into stable/fraser
-rw-r--r--yardstick/tests/unit/common/test_utils.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/yardstick/tests/unit/common/test_utils.py b/yardstick/tests/unit/common/test_utils.py
index 87995ac49..5fd91c87f 100644
--- a/yardstick/tests/unit/common/test_utils.py
+++ b/yardstick/tests/unit/common/test_utils.py
@@ -894,7 +894,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',
@@ -926,23 +926,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',