diff options
author | Linda Wang <wangwulin@huawei.com> | 2017-12-04 08:33:59 +0000 |
---|---|---|
committer | Linda Wang <wangwulin@huawei.com> | 2017-12-14 07:23:00 +0000 |
commit | 3f29dd2f11e3bb847fce5ac56060758d6076e8e7 (patch) | |
tree | d8fce3daf5820ed65082a2451700e2cc9742c858 /functest/tests/unit/ci/test_run_tests.py | |
parent | 3306da5522f2576f2cd8431aac7fd4f3f4b32ca3 (diff) |
Improve the pylint score of functest-core
It also modifies the file list to ensure the rating of ci modules.
Change-Id: Ia1e414be5364cb3da3d54882db428024ed6bd99f
Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'functest/tests/unit/ci/test_run_tests.py')
-rw-r--r-- | functest/tests/unit/ci/test_run_tests.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/functest/tests/unit/ci/test_run_tests.py b/functest/tests/unit/ci/test_run_tests.py index bc95f8f3..93cbfccd 100644 --- a/functest/tests/unit/ci/test_run_tests.py +++ b/functest/tests/unit/ci/test_run_tests.py @@ -58,14 +58,14 @@ class RunTestsTesting(unittest.TestCase): self.run_tests_parser = run_tests.RunTestsParser() - @mock.patch('functest.ci.run_tests.logger.error') + @mock.patch('functest.ci.run_tests.LOGGER.error') def test_source_rc_file_missing_file(self, mock_logger_error): with mock.patch('functest.ci.run_tests.os.path.isfile', return_value=False), \ self.assertRaises(Exception): self.runner.source_rc_file() - @mock.patch('functest.ci.run_tests.logger.debug') + @mock.patch('functest.ci.run_tests.LOGGER.debug') @mock.patch('functest.ci.run_tests.os.path.isfile', return_value=True) def test_source_rc_file_default(self, *args): @@ -81,7 +81,7 @@ class RunTestsTesting(unittest.TestCase): self.assertEqual(self.runner.get_run_dict('test_name'), mock_obj) - @mock.patch('functest.ci.run_tests.logger.error') + @mock.patch('functest.ci.run_tests.LOGGER.error') def test_get_run_dict_if_defined_missing_config_option(self, mock_logger_error): with mock.patch('functest.ci.run_tests.' @@ -90,9 +90,8 @@ class RunTestsTesting(unittest.TestCase): testname = 'test_name' self.assertEqual(self.runner.get_run_dict(testname), None) - mock_logger_error.assert_called_once_with("Cannot get {}'s config " - "options" - .format(testname)) + mock_logger_error.assert_called_once_with( + "Cannot get %s's config options", testname) with mock.patch('functest.ci.run_tests.' 'ft_utils.get_dict_by_test', @@ -101,7 +100,7 @@ class RunTestsTesting(unittest.TestCase): self.assertEqual(self.runner.get_run_dict(testname), None) - @mock.patch('functest.ci.run_tests.logger.exception') + @mock.patch('functest.ci.run_tests.LOGGER.exception') def test_get_run_dict_if_defined_exception(self, mock_logger_except): with mock.patch('functest.ci.run_tests.' @@ -110,9 +109,8 @@ class RunTestsTesting(unittest.TestCase): testname = 'test_name' self.assertEqual(self.runner.get_run_dict(testname), None) - mock_logger_except.assert_called_once_with("Cannot get {}'s config" - " options" - .format(testname)) + mock_logger_except.assert_called_once_with( + "Cannot get %s's config options", testname) def test_run_tests_import_test_class_exception(self): mock_test = mock.Mock() @@ -153,14 +151,14 @@ class RunTestsTesting(unittest.TestCase): run_tests.Result.EX_OK) mock_methods[0].assert_called_with(mock.ANY) - @mock.patch('functest.ci.run_tests.logger.info') + @mock.patch('functest.ci.run_tests.LOGGER.info') def test_run_tier_missing_test(self, mock_logger_info): self.tier.get_tests.return_value = None self.assertEqual(self.runner.run_tier(self.tier), run_tests.Result.EX_ERROR) self.assertTrue(mock_logger_info.called) - @mock.patch('functest.ci.run_tests.logger.info') + @mock.patch('functest.ci.run_tests.LOGGER.info') @mock.patch('functest.ci.run_tests.Runner.run_tier') @mock.patch('functest.ci.run_tests.Runner.summary') def test_run_all_default(self, *mock_methods): @@ -169,7 +167,7 @@ class RunTestsTesting(unittest.TestCase): mock_methods[1].assert_not_called() self.assertTrue(mock_methods[2].called) - @mock.patch('functest.ci.run_tests.logger.info') + @mock.patch('functest.ci.run_tests.LOGGER.info') @mock.patch('functest.ci.run_tests.Runner.summary') def test_run_all_missing_tier(self, *mock_methods): CONST.__setattr__('CI_LOOP', 'loop_re_not_available') |