summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2017-05-26 15:37:30 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-02 13:36:13 +0100
commit5507c394e795a13701c6d3e0017e13feea217581 (patch)
tree363be39ca870e1e199afd832c41ec91ad49d819e
parentd05acd6babffedd7150d3abd8fece7bb553aeebb (diff)
downloadpoky-5507c394e795a13701c6d3e0017e13feea217581.tar.gz
oeqa/core: Don't expose OEStreamLogger in OETestContext
The OEStreamLogger class is used for redirect PyUnit output to a certain logger so there is not need to expose at level of OETestContext because only OETestRunner needs to know. [YOCTO #11450] (From OE-Core rev: 8787fba3df8acd9d2438669d20b1a5060caa9022) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/core/context.py6
-rw-r--r--meta/lib/oeqa/core/runner.py3
2 files changed, 5 insertions, 4 deletions
diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py
index 4476750a3c..2628651fa3 100644
--- a/meta/lib/oeqa/core/context.py
+++ b/meta/lib/oeqa/core/context.py
@@ -10,12 +10,11 @@ import collections
10import re 10import re
11 11
12from oeqa.core.loader import OETestLoader 12from oeqa.core.loader import OETestLoader
13from oeqa.core.runner import OETestRunner, OEStreamLogger, xmlEnabled 13from oeqa.core.runner import OETestRunner, xmlEnabled
14 14
15class OETestContext(object): 15class OETestContext(object):
16 loaderClass = OETestLoader 16 loaderClass = OETestLoader
17 runnerClass = OETestRunner 17 runnerClass = OETestRunner
18 streamLoggerClass = OEStreamLogger
19 18
20 files_dir = os.path.abspath(os.path.join(os.path.dirname( 19 files_dir = os.path.abspath(os.path.join(os.path.dirname(
21 os.path.abspath(__file__)), "../files")) 20 os.path.abspath(__file__)), "../files"))
@@ -52,8 +51,7 @@ class OETestContext(object):
52 self.suites = self.loader.discover() 51 self.suites = self.loader.discover()
53 52
54 def runTests(self): 53 def runTests(self):
55 streamLogger = self.streamLoggerClass(self.logger) 54 self.runner = self.runnerClass(self, verbosity=2)
56 self.runner = self.runnerClass(self, stream=streamLogger, verbosity=2)
57 55
58 self._run_start_time = time.time() 56 self._run_start_time = time.time()
59 result = self.runner.run(self.suites) 57 result = self.runner.run(self.suites)
diff --git a/meta/lib/oeqa/core/runner.py b/meta/lib/oeqa/core/runner.py
index 44ffecb0cd..40fbf3b423 100644
--- a/meta/lib/oeqa/core/runner.py
+++ b/meta/lib/oeqa/core/runner.py
@@ -48,12 +48,15 @@ class OETestResult(_TestResult):
48 super(OETestResult, self).startTest(test) 48 super(OETestResult, self).startTest(test)
49 49
50class OETestRunner(_TestRunner): 50class OETestRunner(_TestRunner):
51 streamLoggerClass = OEStreamLogger
52
51 def __init__(self, tc, *args, **kwargs): 53 def __init__(self, tc, *args, **kwargs):
52 if xmlEnabled: 54 if xmlEnabled:
53 if not kwargs.get('output'): 55 if not kwargs.get('output'):
54 kwargs['output'] = os.path.join(os.getcwd(), 56 kwargs['output'] = os.path.join(os.getcwd(),
55 'TestResults_%s_%s' % (time.strftime("%Y%m%d%H%M%S"), os.getpid())) 57 'TestResults_%s_%s' % (time.strftime("%Y%m%d%H%M%S"), os.getpid()))
56 58
59 kwargs['stream'] = self.streamLoggerClass(tc.logger)
57 super(OETestRunner, self).__init__(*args, **kwargs) 60 super(OETestRunner, self).__init__(*args, **kwargs)
58 self.tc = tc 61 self.tc = tc
59 self.resultclass = OETestResult 62 self.resultclass = OETestResult