aboutsummaryrefslogtreecommitdiffstats
path: root/functest/core/feature.py
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2017-05-05 07:51:35 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-05-05 07:51:35 +0000
commite9b9d37c1c8268c9cde8db48458e39bce1f5b133 (patch)
tree685694273ab372360642ed5fcfd91148dcc06b13 /functest/core/feature.py
parent533e08503e5888adb7a7cfa8b112502385130a8f (diff)
parent3154346cfd22a3d500dc2fd01495e181308d12d6 (diff)
Merge "Define loggers as class-private members"
Diffstat (limited to 'functest/core/feature.py')
-rw-r--r--functest/core/feature.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/functest/core/feature.py b/functest/core/feature.py
index 992de98a..ed9efc70 100644
--- a/functest/core/feature.py
+++ b/functest/core/feature.py
@@ -27,7 +27,7 @@ __author__ = ("Serena Feng <feng.xiaowei@zte.com.cn>, "
class Feature(base.TestCase):
"""Base model for single feature."""
- logger = logging.getLogger(__name__)
+ __logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
super(Feature, self).__init__(**kwargs)
@@ -83,10 +83,10 @@ class Feature(base.TestCase):
ft_utils.logger_test_results(
self.project_name, self.case_name,
self.result, self.details)
- self.logger.info("%s %s", self.project_name, self.result)
+ self.__logger.info("%s %s", self.project_name, self.result)
except Exception: # pylint: disable=broad-except
- self.logger.exception("%s FAILED", self.project_name)
- self.logger.info("Test result is stored in '%s'", self.result_file)
+ self.__logger.exception("%s FAILED", self.project_name)
+ self.__logger.info("Test result is stored in '%s'", self.result_file)
self.stop_time = time.time()
return exit_code
@@ -94,6 +94,8 @@ class Feature(base.TestCase):
class BashFeature(Feature):
"""Class designed to run any bash command."""
+ __logger = logging.getLogger(__name__)
+
def execute(self, **kwargs):
"""Execute the cmd passed as arg
@@ -109,7 +111,7 @@ class BashFeature(Feature):
cmd = kwargs["cmd"]
ret = ft_utils.execute_command(cmd, output_file=self.result_file)
except KeyError:
- self.logger.error("Please give cmd as arg. kwargs: %s", kwargs)
+ self.__logger.error("Please give cmd as arg. kwargs: %s", kwargs)
except Exception: # pylint: disable=broad-except
- self.logger.exception("Execute cmd: %s failed", cmd)
+ self.__logger.exception("Execute cmd: %s failed", cmd)
return ret