From f4e49ae7753901336814ccbd26003ac229440f5b Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Wed, 20 Dec 2017 19:19:20 +0100 Subject: Remove logger_test_results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was only called in Feature which the result is already printed (see __str__()). It also eases moving Feature to xtesting as it breaks the link to functest_utils. Change-Id: Ib72d651dc7d89598704ff4d52d8b1ecb2bdade5b Signed-off-by: Cédric Ollivier --- functest/core/feature.py | 3 --- functest/tests/unit/utils/test_functest_utils.py | 32 ----------------------- functest/utils/functest_utils.py | 33 ------------------------ 3 files changed, 68 deletions(-) diff --git a/functest/core/feature.py b/functest/core/feature.py index 010ff4bc9..2dc3ccbd6 100644 --- a/functest/core/feature.py +++ b/functest/core/feature.py @@ -98,9 +98,6 @@ class Feature(base.TestCase): if self.execute(**kwargs) == 0: exit_code = base.TestCase.EX_OK self.result = 100 - ft_utils.logger_test_results( - self.project_name, self.case_name, - self.result, self.details) except Exception: # pylint: disable=broad-except self.__logger.exception("%s FAILED", self.project_name) self.__logger.info("Test result is stored in '%s'", self.result_file) diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py index 17fb4c1f8..7a77d25b9 100644 --- a/functest/tests/unit/utils/test_functest_utils.py +++ b/functest/tests/unit/utils/test_functest_utils.py @@ -113,38 +113,6 @@ class FunctestUtilsTesting(unittest.TestCase): CONST.__setattr__('BUILD_TAG', 'unknown_build_tag') self.assertEqual(functest_utils.get_version(), "unknown") - @mock.patch('functest.utils.functest_utils.logger.info') - def test_logger_test_results(self, mock_logger_info): - CONST.__setattr__('results_test_db_url', self.db_url) - CONST.__setattr__('BUILD_TAG', self.build_tag) - CONST.__setattr__('NODE_NAME', self.node_name) - CONST.__setattr__('DEPLOY_SCENARIO', self.scenario) - with mock.patch('functest.utils.functest_utils.get_version', - return_value=self.version): - functest_utils.logger_test_results(self.project, self.case_name, - self.status, self.details) - mock_logger_info.assert_called_once_with( - "\n" - "****************************************\n" - "\t %(p)s/%(n)s results \n\n" - "****************************************\n" - "DB:\t%(db)s\n" - "pod:\t%(pod)s\n" - "version:\t%(v)s\n" - "scenario:\t%(s)s\n" - "status:\t%(c)s\n" - "build tag:\t%(b)s\n" - "details:\t%(d)s\n" - % {'p': self.project, - 'n': self.case_name, - 'db': CONST.__getattribute__('results_test_db_url'), - 'pod': self.node_name, - 'v': self.version, - 's': self.scenario, - 'c': self.status, - 'b': self.build_tag, - 'd': self.details}) - def _get_env_dict(self, var): dic = {'INSTALLER_TYPE': self.installer, 'DEPLOY_SCENARIO': self.scenario, diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index 6c502ebc5..6d0b345d5 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -90,39 +90,6 @@ def get_version(): return "unknown" -def logger_test_results(project, case_name, status, details): - """ - Format test case results for the logger - """ - pod_name = CONST.__getattribute__('NODE_NAME') - scenario = CONST.__getattribute__('DEPLOY_SCENARIO') - version = get_version() - build_tag = CONST.__getattribute__('BUILD_TAG') - db_url = CONST.__getattribute__("results_test_db_url") - - logger.info( - "\n" - "****************************************\n" - "\t %(p)s/%(n)s results \n\n" - "****************************************\n" - "DB:\t%(db)s\n" - "pod:\t%(pod)s\n" - "version:\t%(v)s\n" - "scenario:\t%(s)s\n" - "status:\t%(c)s\n" - "build tag:\t%(b)s\n" - "details:\t%(d)s\n" - % {'p': project, - 'n': case_name, - 'db': db_url, - 'pod': pod_name, - 'v': version, - 's': scenario, - 'c': status, - 'b': build_tag, - 'd': details}) - - @decorators.can_dump_request_to_file def push_results_to_db(project, case_name, start_date, stop_date, result, details): -- cgit 1.2.3-korg