From a84b4aa3d77d17cb5f798aee136660070d19766e Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Thu, 3 Mar 2022 17:49:45 +0100 Subject: Complete previous commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It adds xtesting/utils/config.py Change-Id: Iaa36568d7b4e1f6c3cfa1d74cf81d9d73a61f3eb Signed-off-by: Cédric Ollivier --- xtesting/utils/config.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 xtesting/utils/config.py 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 -- cgit 1.2.3-korg