aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/utils/config.py
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-04 15:01:06 +0100
commit43ed792ae54af5d3179e16eb29e9b9821e7e1dee (patch)
tree37bb0416b5306c7bb11fbee3209fc20219cfbfa0 /xtesting/utils/config.py
parent1fbc8086d445b53547f19b436da93579949c93ae (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/utils/config.py')
-rw-r--r--xtesting/utils/config.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/xtesting/utils/config.py b/xtesting/utils/config.py
new file mode 100644
index 00000000..6f94fc8f
--- /dev/null
+++ b/xtesting/utils/config.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2022 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# pylint: disable=missing-docstring
+
+import os
+
+from xtesting.utils import constants
+
+
+def get_xtesting_config(filename, default):
+ """Search Xtesting configs (i.e. testcases.yaml)"""
+ 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