From 75c869b6a39e94fe06ececa5b5a2b39807aa6daa Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Thu, 3 Mar 2022 16:59:14 +0100 Subject: Rewrite last direct call to ci/testcases.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic4a857b6cdee7e3f9e2330414b0e6a6df98eea25 Signed-off-by: Cédric Ollivier --- xtesting/ci/run_tests.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'xtesting/ci') diff --git a/xtesting/ci/run_tests.py b/xtesting/ci/run_tests.py index c88c8282..0b94c28b 100644 --- a/xtesting/ci/run_tests.py +++ b/xtesting/ci/run_tests.py @@ -23,13 +23,13 @@ import sys import textwrap import enum -import pkg_resources import prettytable from stevedore import driver import yaml from xtesting.ci import tier_builder from xtesting.core import testcase +from xtesting.utils import config from xtesting.utils import constants from xtesting.utils import env @@ -88,7 +88,7 @@ class Runner(): self.clean_flag = True self.report_flag = False self.push_flag = False - self.tiers = tier_builder.TierBuilder(_get_xtesting_config( + self.tiers = tier_builder.TierBuilder(config.get_xtesting_config( constants.TESTCASE_DESCRIPTION, constants.TESTCASE_DESCRIPTION_DEFAULT)) @@ -115,8 +115,10 @@ class Runner(): @staticmethod def get_dict_by_test(testname): # pylint: disable=missing-docstring - with open(pkg_resources.resource_filename( - 'xtesting', 'ci/testcases.yaml'), encoding='utf-8') as tyaml: + with open(config.get_xtesting_config( + constants.TESTCASE_DESCRIPTION, + constants.TESTCASE_DESCRIPTION_DEFAULT), + encoding='utf-8') as tyaml: testcases_yaml = yaml.safe_load(tyaml) for dic_tier in testcases_yaml.get("tiers"): for dic_testcase in dic_tier['testcases']: @@ -305,14 +307,6 @@ class Runner(): LOGGER.info("Xtesting report:\n\n%s\n", msg) -def _get_xtesting_config(filename, default): - for path in constants.XTESTING_PATHES: - abspath = os.path.abspath(os.path.expanduser(path)) - if os.path.isfile(os.path.join(abspath, filename)): - return os.path.join(abspath, filename) - return default - - def main(): """Entry point""" try: @@ -322,10 +316,10 @@ def main(): print(f"Cannot create {constants.RESULTS_DIR}") return testcase.TestCase.EX_RUN_ERROR if env.get('DEBUG').lower() == 'true': - logging.config.fileConfig(_get_xtesting_config( + logging.config.fileConfig(config.get_xtesting_config( 'logging.debug.ini', constants.DEBUG_INI_PATH_DEFAULT)) else: - logging.config.fileConfig(_get_xtesting_config( + logging.config.fileConfig(config.get_xtesting_config( 'logging.ini', constants.INI_PATH_DEFAULT)) logging.captureWarnings(True) parser = RunTestsParser() -- cgit 1.2.3-korg