diff options
author | 2018-08-10 12:55:10 +0200 | |
---|---|---|
committer | 2018-08-12 18:32:59 +0200 | |
commit | 95092b511dbacac412dbe5b8ff3a28abb3d3f664 (patch) | |
tree | 24a547cf1a687af0d4db184375abcc03aef998ba /xtesting/core/testcase.py | |
parent | a9491ef0948f8fe3eb3772b6b6ae44d86bde7e9b (diff) |
Leverage on abc and stevedore
Change-Id: I7b3c4c0c5dd0c9e6fb3e52c3fff5221d4b831b02
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'xtesting/core/testcase.py')
-rw-r--r-- | xtesting/core/testcase.py | 13 |
1 files changed, 6 insertions, 7 deletions
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): |