From 3298811ce85e54c3c766ca7cf1e77bfd66956ab5 Mon Sep 17 00:00:00 2001 From: xudan Date: Thu, 15 Dec 2016 02:09:35 +0000 Subject: dovetail tool: bugfix about setup dovetail 1. change the entry_points of setup.cfg into dovetail.run:main 2. after setup the command 'dovetail -d true --testsuite debug' can just be successfully executed under folder dovetail/dovetail. That is mainly because of the load functions of testcase.py using relative paths. 3. using absolute path instead of relative path can support the command successfully executed under any path. JIRA: DOVETAIL-154 Change-Id: I4a2ad39a1a60e7e63efc55515781d27b823aa894 Signed-off-by: xudan --- .gitignore | 2 +- dovetail/compliance/debug.yml | 2 +- dovetail/conf/dovetail_config.yml | 4 ++-- dovetail/testcase.py | 12 ++++++++---- setup.cfg | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index cae3e659..865a88c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ *.py[cod] # Packages -*.egg +*.egg* .testrepository dist build diff --git a/dovetail/compliance/debug.yml b/dovetail/compliance/debug.yml index 8cc4b36c..13ba335c 100644 --- a/dovetail/compliance/debug.yml +++ b/dovetail/compliance/debug.yml @@ -4,7 +4,7 @@ debug: name: debug testcases_list: - - dovetail.example.tc002 + - dovetail.example.tc002 - dovetail.ipv6.tc001 - dovetail.nfvi.tc001 - dovetail.nfvi.tc002 diff --git a/dovetail/conf/dovetail_config.yml b/dovetail/conf/dovetail_config.yml index c01394ed..2476ed1f 100644 --- a/dovetail/conf/dovetail_config.yml +++ b/dovetail/conf/dovetail_config.yml @@ -5,8 +5,8 @@ report_file: 'dovetail_report.txt' cli_file_name: 'cmd_config.yml' # TO DO: once version scheme settled, adjust accordingly repo: 'https://github.com/opnfv/dovetail/tree/master/' -COMPLIANCE_PATH: ./compliance/ -TESTCASE_PATH: ./testcase/ +COMPLIANCE_PATH: compliance/ +TESTCASE_PATH: testcase/ # testsuite supported, should adjust accordingly testsuite_supported: - compliance_set diff --git a/dovetail/testcase.py b/dovetail/testcase.py index 4310f9b4..dd0fd2b5 100644 --- a/dovetail/testcase.py +++ b/dovetail/testcase.py @@ -158,8 +158,10 @@ class Testcase(object): @classmethod def load(cls): - for root, dirs, files in \ - os.walk(dt_cfg.dovetail_config['TESTCASE_PATH']): + 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) + 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: testcase_yaml = yaml.safe_load(f) @@ -254,8 +256,10 @@ class Testsuite: @classmethod def load(cls): - for root, dirs, files in \ - os.walk(dt_cfg.dovetail_config['COMPLIANCE_PATH']): + 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) + 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: testsuite_yaml = yaml.safe_load(f) diff --git a/setup.cfg b/setup.cfg index c691f066..46f2c4d4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,4 +4,4 @@ home-page = https://wiki.opnfv.org/display/dovetail [entry_points] console_scripts = - dovetail = dovetail.main:main + dovetail = dovetail.run:main -- cgit 1.2.3-korg