aboutsummaryrefslogtreecommitdiffstats
path: root/functest/core/testcase.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/testcase.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/testcase.py')
-rw-r--r--functest/core/testcase.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/functest/core/testcase.py b/functest/core/testcase.py
index 0b87f265..217f07e5 100644
--- a/functest/core/testcase.py
+++ b/functest/core/testcase.py
@@ -32,7 +32,7 @@ class TestCase(object):
EX_TESTCASE_FAILED = os.EX_SOFTWARE - 2
"""results are false"""
- logger = logging.getLogger(__name__)
+ __logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
self.details = {}
@@ -65,12 +65,12 @@ class TestCase(object):
# It must be removed as soon as TestCase subclasses
# stop setting result = 'PASS' or 'FAIL'.
# In this case criteria is unread.
- self.logger.warning(
+ self.__logger.warning(
"Please update result which must be an int!")
if self.result == 'PASS':
return TestCase.EX_OK
except AssertionError:
- self.logger.error("Please run test before checking the results")
+ self.__logger.error("Please run test before checking the results")
return TestCase.EX_TESTCASE_FAILED
def run(self, **kwargs):
@@ -96,7 +96,7 @@ class TestCase(object):
TestCase.EX_RUN_ERROR.
"""
# pylint: disable=unused-argument
- self.logger.error("Run must be implemented")
+ self.__logger.error("Run must be implemented")
return TestCase.EX_RUN_ERROR
def push_to_db(self):
@@ -128,11 +128,12 @@ class TestCase(object):
if ft_utils.push_results_to_db(
self.project_name, self.case_name, self.start_time,
self.stop_time, pub_result, self.details):
- self.logger.info("The results were successfully pushed to DB")
+ self.__logger.info(
+ "The results were successfully pushed to DB")
return TestCase.EX_OK
else:
- self.logger.error("The results cannot be pushed to DB")
+ self.__logger.error("The results cannot be pushed to DB")
return TestCase.EX_PUSH_TO_DB_ERROR
except Exception: # pylint: disable=broad-except
- self.logger.exception("The results cannot be pushed to DB")
+ self.__logger.exception("The results cannot be pushed to DB")
return TestCase.EX_PUSH_TO_DB_ERROR