aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/utils/config.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2022-03-03 17:49:45 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2022-03-03 17:49:45 +0100
commita84b4aa3d77d17cb5f798aee136660070d19766e (patch)
tree752ff99aad66442d5243bda4323972e3efde82ad /xtesting/utils/config.py
parent75c869b6a39e94fe06ececa5b5a2b39807aa6daa (diff)
Complete previous commit
It adds xtesting/utils/config.py Change-Id: Iaa36568d7b4e1f6c3cfa1d74cf81d9d73a61f3eb 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