Complete previous commit 45/73245/1
authorCédric Ollivier <cedric.ollivier@orange.com>
Thu, 3 Mar 2022 16:49:45 +0000 (17:49 +0100)
committerCédric Ollivier <cedric.ollivier@orange.com>
Thu, 3 Mar 2022 16:49:45 +0000 (17:49 +0100)
It adds xtesting/utils/config.py

Change-Id: Iaa36568d7b4e1f6c3cfa1d74cf81d9d73a61f3eb
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
xtesting/utils/config.py [new file with mode: 0644]

diff --git a/xtesting/utils/config.py b/xtesting/utils/config.py
new file mode 100644 (file)
index 0000000..6f94fc8
--- /dev/null
@@ -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