dovetail tool: bugfix about setup dovetail 01/26001/2
authorxudan <xudan16@huawei.com>
Thu, 15 Dec 2016 02:09:35 +0000 (02:09 +0000)
committerxudan <xudan16@huawei.com>
Thu, 15 Dec 2016 10:17:14 +0000 (10:17 +0000)
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 <xudan16@huawei.com>
.gitignore
dovetail/compliance/debug.yml
dovetail/conf/dovetail_config.yml
dovetail/testcase.py
setup.cfg

index cae3e65..865a88c 100644 (file)
@@ -1,7 +1,7 @@
 *.py[cod]
 
 # Packages
-*.egg
+*.egg*
 .testrepository
 dist
 build
index 8cc4b36..13ba335 100644 (file)
@@ -4,7 +4,7 @@
 debug:
   name: debug
   testcases_list:
-    - dovetail.example.tc002 
+    - dovetail.example.tc002
     - dovetail.ipv6.tc001
     - dovetail.nfvi.tc001
     - dovetail.nfvi.tc002
index c01394e..2476ed1 100644 (file)
@@ -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
index 4310f9b..dd0fd2b 100644 (file)
@@ -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)
index c691f06..46f2c4d 100644 (file)
--- 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