diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2016-10-12 15:07:03 +0200 |
---|---|---|
committer | Jose Lausuch <jose.lausuch@ericsson.com> | 2016-10-18 14:04:20 +0000 |
commit | 2aa78bdb5b21ac54b2f1183001c7466e59952c29 (patch) | |
tree | 1a59d96aeb745296abade415ebb12a05ac204aee /utils | |
parent | d04a2af1d4864014492702a8a48bf1171cae6bcb (diff) |
Use importlib to load testcases
It modifies run_tests.py to dynamically execute testcases and then
removes the test condition about odl.
It also induces that the modules and the related classes must be
defined in ci/testcases.yaml.
JIRA: FUNCTEST-353
Change-Id: I6ad67b70624aac6bf805c9bde4dfef7c9fbd5c00
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/functest_utils.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/utils/functest_utils.py b/utils/functest_utils.py index ef865bedf..41b6485d9 100644 --- a/utils/functest_utils.py +++ b/utils/functest_utils.py @@ -341,19 +341,26 @@ def get_deployment_dir(): return deployment_dir -def get_criteria_by_test(testname): +def get_dict_by_test(testname): with open(get_testcases_file()) as f: testcases_yaml = yaml.safe_load(f) for dic_tier in testcases_yaml.get("tiers"): for dic_testcase in dic_tier['testcases']: if dic_testcase['name'] == testname: - return dic_testcase['criteria'] + return dic_testcase logger.error('Project %s is not defined in testcases.yaml' % testname) return None +def get_criteria_by_test(testname): + dict = get_dict_by_test(testname) + if dict: + return dict['criteria'] + return None + + # ---------------------------------------------------------- # # YAML UTILS |