aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2017-05-15 15:47:33 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2017-05-15 15:49:08 +0200
commitf4b88ec5e387deb80230afa852313127f48040ed (patch)
tree73bcac8100c11a5f6678d165742219c25bab1f36
parent6e0a0070d775cf5f266cda53eb7c004cecb0511c (diff)
Get a logger before printing
It also fixes pylint errors. Change-Id: I0d973360574a517724d0be3986c788c3ce7f54d4 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--functest/core/pytest_suite_runner.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/functest/core/pytest_suite_runner.py b/functest/core/pytest_suite_runner.py
index 21edc1874..2b201ee08 100644
--- a/functest/core/pytest_suite_runner.py
+++ b/functest/core/pytest_suite_runner.py
@@ -5,12 +5,18 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
-import testcase as base
+# pylint: disable=missing-docstring
+
+import logging
import unittest
import time
+from functest.core import testcase
+
+logging.basicConfig()
+
-class PyTestSuiteRunner(base.TestCase):
+class PyTestSuiteRunner(testcase.TestCase):
"""
This superclass is designed to execute pre-configured unittest.TestSuite()
objects
@@ -18,7 +24,7 @@ class PyTestSuiteRunner(base.TestCase):
def __init__(self, **kwargs):
super(PyTestSuiteRunner, self).__init__(**kwargs)
self.suite = None
- self.logger = None
+ self.logger = logging.getLogger(__name__)
def run(self, **kwargs):
"""
@@ -45,13 +51,13 @@ class PyTestSuiteRunner(base.TestCase):
# we shall distinguish Execution Error from FAIL results
# TestCase.EX_RUN_ERROR means that the test case was not run
# not that it was run but the result was FAIL
- exit_code = base.TestCase.EX_OK
+ exit_code = testcase.TestCase.EX_OK
if ((result.errors and len(result.errors) > 0)
or (result.failures and len(result.failures) > 0)):
- self.logger.info("%s FAILED" % self.case_name)
+ self.logger.info("%s FAILED", self.case_name)
self.result = 'FAIL'
else:
- self.logger.info("%s OK" % self.case_name)
+ self.logger.info("%s OK", self.case_name)
self.result = 'PASS'
self.details = {}