diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2017-03-28 18:42:42 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2017-03-28 20:27:51 +0800 |
commit | eaacf8913a141b1e518ea990e7f12f0a195f8c21 (patch) | |
tree | d2f86fe4b62de96ad3b72f1ccbfe1a7809830742 /functest/core/feature_base.py | |
parent | cff5b6d61f6d7a8e42433c7deebcdeed743b92ca (diff) |
rename feature_base to feature
remove useless suffix _base
Change-Id: I63a73fd6fef2fccd9b92c405f64dda50735b0026
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'functest/core/feature_base.py')
-rw-r--r-- | functest/core/feature_base.py | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/functest/core/feature_base.py b/functest/core/feature_base.py deleted file mode 100644 index f7f3e460..00000000 --- a/functest/core/feature_base.py +++ /dev/null @@ -1,63 +0,0 @@ -import time - -import testcase as base -import functest.utils.functest_utils as ft_utils -import functest.utils.functest_logger as ft_logger -from functest.utils.constants import CONST - - -class FeatureBase(base.TestCase): - - def __init__(self, project='functest', case='', repo='', cmd=''): - super(FeatureBase, self).__init__() - self.project_name = project - self.case_name = case - self.cmd = cmd - self.repo = CONST.__getattribute__(repo) - self.result_file = self.get_result_file() - self.logger = ft_logger.Logger(project).getLogger() - - def run(self, **kwargs): - self.prepare() - self.start_time = time.time() - ret = self.execute() - self.stop_time = time.time() - self.post() - self.parse_results(ret) - self.log_results() - self.logger.info("Test result is stored in '%s'" % self.result_file) - return base.TestCase.EX_OK - - def execute(self): - ''' - Executer method that can be overwritten - By default it executes a shell command. - ''' - return ft_utils.execute_command(self.cmd, output_file=self.result_file) - - def prepare(self, **kwargs): - pass - - def post(self, **kwargs): - pass - - def parse_results(self, ret): - exit_code = base.TestCase.EX_OK - if ret == 0: - self.logger.info("{} OK".format(self.project_name)) - self.criteria = 'PASS' - else: - self.logger.info("{} FAILED".format(self.project_name)) - exit_code = base.TestCase.EX_RUN_ERROR - self.criteria = "FAIL" - - return exit_code - - def get_result_file(self): - return "{}/{}.log".format(CONST.dir_results, self.project_name) - - def log_results(self): - ft_utils.logger_test_results(self.project_name, - self.case_name, - self.criteria, - self.details) |