summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2017-05-23 19:20:20 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2017-05-29 12:03:44 +0200
commit475090f0d7a679b8c223a225c16eb858cbc7d82d (patch)
treef13acf9dfc7e88a606172607ff8458b3d3700062
parent34b2583ee5509daf8b237a9c55173026ad42b2bc (diff)
Rename logger to __logger in unit.py
This mangling ensures that all info messages printed from core packages. Change-Id: I77ac1c80360d45ef19ed7c3fa05a894804c92216 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--functest/core/unit.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/functest/core/unit.py b/functest/core/unit.py
index 5c4d20067..515a20806 100644
--- a/functest/core/unit.py
+++ b/functest/core/unit.py
@@ -26,10 +26,11 @@ __author__ = ("Steven Pisarski <s.pisarski@cablelabs.com>, "
class Suite(testcase.TestCase):
"""Base model for running unittest.TestSuite."""
+ __logger = logging.getLogger(__name__)
+
def __init__(self, **kwargs):
super(Suite, self).__init__(**kwargs)
self.suite = None
- self.logger = logging.getLogger(__name__)
def run(self, **kwargs):
"""Run the test suite.
@@ -61,7 +62,7 @@ class Suite(testcase.TestCase):
try:
self.suite = unittest.TestLoader().loadTestsFromName(name)
except ImportError:
- self.logger.error("Can not import %s", name)
+ self.__logger.error("Can not import %s", name)
return testcase.TestCase.EX_RUN_ERROR
except KeyError:
pass
@@ -71,7 +72,7 @@ class Suite(testcase.TestCase):
stream = six.StringIO()
result = unittest.TextTestRunner(
stream=stream, verbosity=2).run(self.suite)
- self.logger.debug("\n\n%s", stream.getvalue())
+ self.__logger.debug("\n\n%s", stream.getvalue())
self.stop_time = time.time()
self.details = {"failures": result.failures,
"errors": result.errors}
@@ -81,8 +82,8 @@ class Suite(testcase.TestCase):
result.testsRun)
return testcase.TestCase.EX_OK
except AssertionError:
- self.logger.error("No suite is defined")
+ self.__logger.error("No suite is defined")
return testcase.TestCase.EX_RUN_ERROR
except ZeroDivisionError:
- self.logger.error("No test has been run")
+ self.__logger.error("No test has been run")
return testcase.TestCase.EX_RUN_ERROR