From b90fc8907f0c4ba716d6332159f881f880965277 Mon Sep 17 00:00:00 2001 From: Linghui Zeng Date: Mon, 14 Nov 2016 10:29:21 +0800 Subject: dovetail tool: replace the hard-coded "Tescase" and modify some classmethod JIRA: DOVETAIL-45 1. In the testcase.py file, we replace the hard-coded "Tesecase" with "cls" or "self" based on the specific contexts. 2. For all the four committed files, we modify some classmethod into staticmethod because each method is basically just a function, called syntactically like a method, but without access to the object and its' internals (attributes and other methods). Change-Id: Ieb452f476a2d33ae9aca4c904ae7d2c92b68689e Signed-off-by: Linghui Zeng --- dovetail/report.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'dovetail/report.py') diff --git a/dovetail/report.py b/dovetail/report.py index 127c191d..a828d4f3 100644 --- a/dovetail/report.py +++ b/dovetail/report.py @@ -30,8 +30,8 @@ class Report: results = {'functest': {}, 'yardstick': {}} - @classmethod - def check_result(cls, testcase, db_result): + @staticmethod + def check_result(testcase, db_result): checker = CheckerFactory.create(testcase.script_type()) checker.check(testcase, db_result) @@ -92,8 +92,8 @@ class Report: return rpt_text # save to disk as default - @classmethod - def save(cls, report): + @staticmethod + def save(report): report_file_name = dovetail_config['report_file'] try: with open(os.path.join(dovetail_config['result_dir'], @@ -127,8 +127,8 @@ class Report: class CrawlerFactory: - @classmethod - def create(cls, type): + @staticmethod + def create(type): if type == 'functest': return FunctestCrawler() @@ -234,8 +234,8 @@ class YardstickCrawler: class CheckerFactory: - @classmethod - def create(cls, type): + @staticmethod + def create(type): if type == 'functest': return FunctestChecker() @@ -247,13 +247,15 @@ class CheckerFactory: class ResultChecker: - def check(cls): + @staticmethod + def check(): return 'PASS' class FunctestChecker: - def check(cls, testcase, db_result): + @staticmethod + def check(testcase, db_result): sub_testcase_list = testcase.sub_testcase() if not db_result: @@ -286,7 +288,8 @@ class FunctestChecker: class YardstickChecker: - def check(cls, testcase, result): + @staticmethod + def check(testcase, result): if not result: testcase.passed(False) else: -- cgit 1.2.3-korg