aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-09-02 23:33:22 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-09-05 15:48:46 +0800
commit5b23472699688c5e79e14564f23d9b10bd41b93e (patch)
tree3c342a169eba142c7a57d647cf07a87e0afa3f86 /utils
parent17b720a1addfa444a6248baa9706bf20d012051b (diff)
solve bidirectional dependencies between ci and utils modules
Ci module's run_tests.py references utils module's functest_utils, and functest_utils references ci module's tier_handler. Form a bidirectional dependencies between two packages. JIRA: FUNCTEST-456 Change-Id: Idbdd4896fb1ec786fcfd656832bfe2d4048a8278 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils')
-rw-r--r--utils/functest_utils.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/utils/functest_utils.py b/utils/functest_utils.py
index 644ad1a1b..4a98a8662 100644
--- a/utils/functest_utils.py
+++ b/utils/functest_utils.py
@@ -7,23 +7,21 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
#
-from datetime import datetime as dt
import json
import os
import re
-import requests
import shutil
import subprocess
import sys
import urllib2
-
-import functest.ci.tier_builder as tb
-import functest.utils.functest_logger as ft_logger
+from datetime import datetime as dt
import dns.resolver
-from git import Repo
+import requests
import yaml
+from git import Repo
+import functest.utils.functest_logger as ft_logger
logger = ft_logger.Logger("functest_utils").getLogger()
@@ -350,15 +348,16 @@ def get_deployment_dir():
def get_criteria_by_test(testname):
- criteria = ""
- file = get_testcases_file()
- tiers = tb.TierBuilder("", "", file)
- for tier in tiers.get_tiers():
- for test in tier.get_tests():
- if test.get_name() == testname:
- criteria = test.get_criteria()
-
- return criteria
+ 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']
+
+ logger.error('Project %s is not defined in testcases.yaml' % testname)
+ return None
# ----------------------------------------------------------