summaryrefslogtreecommitdiffstats
path: root/dovetail/report.py
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2016-11-09 06:26:11 +0000
committerxudan <xudan16@huawei.com>2016-11-17 01:23:37 +0000
commit95720ae350260753788dbc92b7d35482165ceb48 (patch)
tree7db03ede2ec561be457869311a251dda367af8af /dovetail/report.py
parent8a6bc92ff3b906a72194c7fa5db61ebb030052a4 (diff)
dovetail tool: reorganize dovetail_config.py and modify related files
1. move all sentencs and functions into class DovetailConfig 2. delete dict container_config for it has been replaced by dovetail_config 2. modify files that import dovetail_config, including container.py, parser.py, report.py, run.py, dovetail_logger.py and testcase.py JIRA: DOVETAIL-55 Change-Id: Ib5ca3cadd751075c879f39e8cb2eb2e0adcef6aa Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'dovetail/report.py')
-rw-r--r--dovetail/report.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/dovetail/report.py b/dovetail/report.py
index a828d4f3..7dd8ba2d 100644
--- a/dovetail/report.py
+++ b/dovetail/report.py
@@ -13,7 +13,7 @@ import os
import utils.dovetail_logger as dt_logger
-from conf.dovetail_config import dovetail_config
+from conf.dovetail_config import DovetailConfig as dt_config
from testcase import Testcase
logger = dt_logger.Logger('report.py').getLogger()
@@ -94,9 +94,9 @@ class Report:
# save to disk as default
@staticmethod
def save(report):
- report_file_name = dovetail_config['report_file']
+ report_file_name = dt_config.dovetail_config['report_file']
try:
- with open(os.path.join(dovetail_config['result_dir'],
+ with open(os.path.join(dt_config.dovetail_config['result_dir'],
report_file_name), 'w') as report_file:
report_file.write(report)
logger.info('save report to %s' % report_file_name)
@@ -144,7 +144,8 @@ class FunctestCrawler:
self.type = 'functest'
def crawl(self, testcase=None):
- store_type = dovetail_config[self.type]['result']['store_type']
+ store_type = \
+ dt_config.dovetail_config[self.type]['result']['store_type']
if store_type == 'file':
return self.crawl_from_file(testcase)
@@ -152,6 +153,7 @@ class FunctestCrawler:
return self.crawl_from_url(testcase)
def crawl_from_file(self, testcase=None):
+ dovetail_config = dt_config.dovetail_config
file_path = \
os.path.join(dovetail_config['result_dir'],
dovetail_config[self.type]['result']['file_path'])
@@ -186,7 +188,8 @@ class FunctestCrawler:
return None
def crawl_from_url(self, testcase=None):
- url = dovetail_config[self.type]['result']['db_url'] % testcase
+ url = \
+ dt_config.dovetail_config[self.type]['result']['db_url'] % testcase
logger.debug("Query to rest api: %s" % url)
try:
data = json.load(urllib2.urlopen(url))
@@ -203,7 +206,8 @@ class YardstickCrawler:
self.type = 'yardstick'
def crawl(self, testcase=None):
- store_type = dovetail_config[self.type]['result']['store_type']
+ store_type = \
+ dt_config.dovetail_config[self.type]['result']['store_type']
if store_type == 'file':
return self.crawl_from_file(testcase)
@@ -211,7 +215,7 @@ class YardstickCrawler:
return self.crawl_from_url(testcase)
def crawl_from_file(self, testcase=None):
- file_path = os.path.join(dovetail_config['result_dir'],
+ file_path = os.path.join(dt_config.dovetail_config['result_dir'],
testcase+'.out')
if not os.path.exists(file_path):
logger.info('result file not found: %s' % file_path)