diff options
Diffstat (limited to 'xtesting/core')
-rw-r--r-- | xtesting/core/feature.py | 9 | ||||
-rw-r--r-- | xtesting/core/testcase.py | 13 |
2 files changed, 10 insertions, 12 deletions
diff --git a/xtesting/core/feature.py b/xtesting/core/feature.py index 932e0230..86215515 100644 --- a/xtesting/core/feature.py +++ b/xtesting/core/feature.py @@ -13,21 +13,25 @@ Feature is considered as TestCase offered by Third-party. It offers helpers to run any python method or any bash command. """ +import abc import logging import subprocess import time +import six from xtesting.core import testcase __author__ = ("Serena Feng <feng.xiaowei@zte.com.cn>, " "Cedric Ollivier <cedric.ollivier@orange.com>") +@six.add_metaclass(abc.ABCMeta) class Feature(testcase.TestCase): """Base model for single feature.""" __logger = logging.getLogger(__name__) + @abc.abstractmethod def execute(self, **kwargs): """Execute the Python method. @@ -39,12 +43,7 @@ class Feature(testcase.TestCase): Args: kwargs: Arbitrary keyword arguments. - - Returns: - -1. """ - # pylint: disable=unused-argument,no-self-use - return -1 def run(self, **kwargs): """Run the feature. diff --git a/xtesting/core/testcase.py b/xtesting/core/testcase.py index 61a2e8c8..c3a1c38c 100644 --- a/xtesting/core/testcase.py +++ b/xtesting/core/testcase.py @@ -9,6 +9,7 @@ """Define the parent class of all Xtesting TestCases.""" +import abc from datetime import datetime import json import logging @@ -17,6 +18,7 @@ import re import requests import prettytable +import six from xtesting.utils import decorators from xtesting.utils import env @@ -24,7 +26,9 @@ from xtesting.utils import env __author__ = "Cedric Ollivier <cedric.ollivier@orange.com>" -class TestCase(object): # pylint: disable=too-many-instance-attributes +@six.add_metaclass(abc.ABCMeta) +class TestCase(object): + # pylint: disable=too-many-instance-attributes """Base model for single test case.""" EX_OK = os.EX_OK @@ -138,6 +142,7 @@ class TestCase(object): # pylint: disable=too-many-instance-attributes """ self.is_skipped = False + @abc.abstractmethod def run(self, **kwargs): """Run the test case. @@ -156,13 +161,7 @@ class TestCase(object): # pylint: disable=too-many-instance-attributes Args: kwargs: Arbitrary keyword arguments. - - Returns: - TestCase.EX_RUN_ERROR. """ - # pylint: disable=unused-argument - self.__logger.error("Run must be implemented") - return TestCase.EX_RUN_ERROR @decorators.can_dump_request_to_file def push_to_db(self): |