diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2022-03-03 15:29:16 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2022-03-04 10:32:25 +0100 |
commit | 5ab58cf461b7803e4c9c5c0983e8c397468d27a8 (patch) | |
tree | 850337598a8aa666f40761ddeb12485137b22e25 /xtesting/ci | |
parent | 98189214d82232f8a24a3a53c9033cd782157635 (diff) |
Search config files in tree
It allows putting configurations in classical dirs.
It fallbacks to the python package for backward compatibility.
Change-Id: Ie33b9482fb197926c7d7d66ace815fa4ae01d02d
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'xtesting/ci')
-rw-r--r-- | xtesting/ci/run_tests.py | 21 | ||||
-rw-r--r-- | xtesting/ci/testcases.yaml | 6 |
2 files changed, 15 insertions, 12 deletions
diff --git a/xtesting/ci/run_tests.py b/xtesting/ci/run_tests.py index 16e7ef16..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,8 +88,9 @@ class Runner(): self.clean_flag = True self.report_flag = False self.push_flag = False - self.tiers = tier_builder.TierBuilder( - pkg_resources.resource_filename('xtesting', 'ci/testcases.yaml')) + self.tiers = tier_builder.TierBuilder(config.get_xtesting_config( + constants.TESTCASE_DESCRIPTION, + constants.TESTCASE_DESCRIPTION_DEFAULT)) @staticmethod def source_envfile(rc_file=constants.ENV_FILE): @@ -114,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']: @@ -313,11 +316,11 @@ def main(): print(f"Cannot create {constants.RESULTS_DIR}") return testcase.TestCase.EX_RUN_ERROR if env.get('DEBUG').lower() == 'true': - logging.config.fileConfig(pkg_resources.resource_filename( - 'xtesting', constants.DEBUG_INI_PATH)) + logging.config.fileConfig(config.get_xtesting_config( + 'logging.debug.ini', constants.DEBUG_INI_PATH_DEFAULT)) else: - logging.config.fileConfig(pkg_resources.resource_filename( - 'xtesting', constants.INI_PATH)) + logging.config.fileConfig(config.get_xtesting_config( + 'logging.ini', constants.INI_PATH_DEFAULT)) logging.captureWarnings(True) parser = RunTestsParser() args = parser.parse_args(sys.argv[1:]) diff --git a/xtesting/ci/testcases.yaml b/xtesting/ci/testcases.yaml index 16dd2632..a5f3f8ea 100644 --- a/xtesting/ci/testcases.yaml +++ b/xtesting/ci/testcases.yaml @@ -51,7 +51,7 @@ tiers: args: suites: - >- - /usr/lib/python3.8/site-packages/xtesting/samples/HelloWorld.robot + /usr/lib/python3.9/site-packages/xtesting/samples/HelloWorld.robot variable: - 'var01:foo' - 'var02:bar' @@ -66,7 +66,7 @@ tiers: name: behaveframework args: suites: - - /usr/lib/python3.8/site-packages/xtesting/samples/features + - /usr/lib/python3.9/site-packages/xtesting/samples/features tags: - foo - case_name: seventh @@ -97,5 +97,5 @@ tiers: run: name: ansible args: - private_data_dir: /usr/lib/python3.8/site-packages/xtesting/samples + private_data_dir: /usr/lib/python3.9/site-packages/xtesting/samples playbook: helloworld.yml |