aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/ci
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2022-03-03 15:29:16 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2022-03-03 15:44:28 +0100
commit8b1c441cd912cc31802f4117e638aab9b379d2d6 (patch)
tree269a8dc3306bc7fdaf0ce8e32b38673cafd8ceac /xtesting/ci
parent318c2e427e2933fdff2213bf807249c66628b56f (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.py21
-rw-r--r--xtesting/ci/testcases.yaml6
2 files changed, 18 insertions, 9 deletions
diff --git a/xtesting/ci/run_tests.py b/xtesting/ci/run_tests.py
index 16e7ef16..c88c8282 100644
--- a/xtesting/ci/run_tests.py
+++ b/xtesting/ci/run_tests.py
@@ -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(_get_xtesting_config(
+ constants.TESTCASE_DESCRIPTION,
+ constants.TESTCASE_DESCRIPTION_DEFAULT))
@staticmethod
def source_envfile(rc_file=constants.ENV_FILE):
@@ -304,6 +305,14 @@ 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:
@@ -313,11 +322,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(_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(_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