diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2021-11-10 15:42:57 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2021-11-15 09:27:07 +0100 |
commit | 4fdbdd34fb5fea55571a18b2438ececa953928ff (patch) | |
tree | 44f1d6ff38cedad25b058ba18844e1004b7385db /functest/tests/unit/utils/test_functest_utils.py | |
parent | e25e576af33547657c278e2dae49b033bf6a1fa1 (diff) |
Update linters and fix all new issues
It mostly add encoding in open calls and leverage f-strings.
Change-Id: Ifead18fc724a452c1067dcf91dc577032edc9c59
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit/utils/test_functest_utils.py')
-rw-r--r-- | functest/tests/unit/utils/test_functest_utils.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py index 1fab8f175..07a57a49a 100644 --- a/functest/tests/unit/utils/test_functest_utils.py +++ b/functest/tests/unit/utils/test_functest_utils.py @@ -108,9 +108,10 @@ class FunctestUtilsTesting(unittest.TestCase): self.cmd, info=True, error_msg=self.error_msg, verbose=True, output_file=self.output_file) self.assertEqual(resp, 1) - msg_exec = ("Executing command: '%s'" % self.cmd) + msg_exec = f"Executing command: '{self.cmd}'" mock_logger_info.assert_called_once_with(msg_exec) - mopen.assert_called_once_with(self.output_file, "w") + mopen.assert_called_once_with( + self.output_file, "w", encoding='utf-8') mock_logger_error.assert_called_once_with(self.error_msg) @mock.patch('functest.utils.functest_utils.LOGGER.info') @@ -129,9 +130,10 @@ class FunctestUtilsTesting(unittest.TestCase): self.cmd, info=True, error_msg=self.error_msg, verbose=True, output_file=self.output_file) self.assertEqual(resp, 0) - msg_exec = ("Executing command: '%s'" % self.cmd) + msg_exec = (f"Executing command: '{self.cmd}'") mock_logger_info.assert_called_once_with(msg_exec) - mopen.assert_called_once_with(self.output_file, "w") + mopen.assert_called_once_with( + self.output_file, "w", encoding='utf-8') @mock.patch('sys.stdout') def test_exec_cmd_args_missing_ok(self, stdout=None): @@ -175,9 +177,9 @@ class FunctestUtilsTesting(unittest.TestCase): mock_yaml.return_value = self.file_yaml functest_utils.get_parameter_from_yaml(self.parameter, self.test_file) - self.assertTrue(("The parameter %s is not" - " defined in config_functest.yaml" % - self.parameter) in excep.exception) + self.assertTrue((f"The parameter {self.parameter} is not" + " defined in config_functest.yaml" + ) in excep.exception) def test_get_param_from_yaml_def(self): with mock.patch('six.moves.builtins.open', mock.mock_open()), \ |