aboutsummaryrefslogtreecommitdiffstats
path: root/functest/core/feature.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2017-05-02 20:57:08 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2017-05-04 16:15:24 +0200
commit3154346cfd22a3d500dc2fd01495e181308d12d6 (patch)
tree39c029ecba238f1ce17e1742982b83e613f123f0 /functest/core/feature.py
parenta87a5f00e1d32af5b193d0376778c966f1aaab3f (diff)
Define loggers as class-private members
This mangling ensures that all info messages printed from core packages are shown in console. It also avoids sphinx to print them. Change-Id: I07db9f33060c195bce3b48b06a6640eb6c56c2eb Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
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