diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2018-03-01 20:03:59 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2018-03-06 09:16:43 +0800 |
commit | b25c1371f82911ea26b8c893b6612bb5ae0c8c19 (patch) | |
tree | 91190d32b9bb723670214b4d91e0bb95cccf5382 /dovetail/testcase.py | |
parent | c308b9a718b8b4fc5e781f8d2a6dbe714e381834 (diff) |
leverage data_files to eliminate so many hardcoded abs_path_seekings
1. mv conf/ userconfig/ compliance/ patch to etc/
2. after installation etc/ will be put under /etc/dovetail
3. leveraging /etc/dovetail in coding
Change-Id: Icf9cb00ff7fc7cf35755f60d3e258b23e2c70839
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'dovetail/testcase.py')
-rw-r--r-- | dovetail/testcase.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/dovetail/testcase.py b/dovetail/testcase.py index 99845484..c9aef0e7 100644 --- a/dovetail/testcase.py +++ b/dovetail/testcase.py @@ -8,13 +8,14 @@ # import os -import yaml -import utils.dovetail_logger as dt_logger +import yaml +from dovetail import constants from parser import Parser -from utils.dovetail_config import DovetailConfig as dt_cfg from test_runner import TestRunnerFactory +from utils.dovetail_config import DovetailConfig as dt_cfg +import utils.dovetail_logger as dt_logger class Testcase(object): @@ -221,9 +222,7 @@ class Testcase(object): @classmethod def load(cls): - testcase_dir = os.path.dirname(os.path.abspath(__file__)) - testcase_path = dt_cfg.dovetail_config['TESTCASE_PATH'] - abs_testcase_path = os.path.join(testcase_dir, testcase_path) + abs_testcase_path = constants.TESTCASE_PATH for root, dirs, files in os.walk(abs_testcase_path): for testcase_file in files: with open(os.path.join(root, testcase_file)) as f: @@ -363,9 +362,7 @@ class Testsuite(object): @classmethod def load(cls): - compliance_dir = os.path.dirname(os.path.abspath(__file__)) - compliance_path = dt_cfg.dovetail_config['COMPLIANCE_PATH'] - abs_compliance_path = os.path.join(compliance_dir, compliance_path) + abs_compliance_path = constants.COMPLIANCE_PATH for root, dirs, files in os.walk(abs_compliance_path): for testsuite_yaml in files: with open(os.path.join(root, testsuite_yaml)) as f: |