summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-13 13:13:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-18 10:18:41 +0100
commitf5975278e3d35b02983217b832975cfde3ad9a9b (patch)
tree0ae28f9f114037b908ee1885170e4eabc9a23351 /meta/lib
parentd9de34ce9906399ae9845d0434e2b2b1642bf46a (diff)
downloadpoky-f5975278e3d35b02983217b832975cfde3ad9a9b.tar.gz
oeqa: Remove xmlrunner
This isn't present on modern distros by default and doesn't work with testtools, needing multiple code paths in the code. Remove it in favour of finding a better replacement for results collection/analysis. (From OE-Core rev: 8001d933a8dc86004db014777f094d718086687d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/core/runner.py54
1 files changed, 9 insertions, 45 deletions
diff --git a/meta/lib/oeqa/core/runner.py b/meta/lib/oeqa/core/runner.py
index 0f84a1d280..6650a63ce7 100644
--- a/meta/lib/oeqa/core/runner.py
+++ b/meta/lib/oeqa/core/runner.py
@@ -7,16 +7,8 @@ import unittest
7import logging 7import logging
8import re 8import re
9 9
10xmlEnabled = False 10from unittest import TextTestResult as _TestResult
11try: 11from unittest import TextTestRunner as _TestRunner
12 import xmlrunner
13 from xmlrunner.result import _XMLTestResult as _TestResult
14 from xmlrunner.runner import XMLTestRunner as _TestRunner
15 xmlEnabled = True
16except ImportError:
17 # use the base runner instead
18 from unittest import TextTestResult as _TestResult
19 from unittest import TextTestRunner as _TestRunner
20 12
21class OEStreamLogger(object): 13class OEStreamLogger(object):
22 def __init__(self, logger): 14 def __init__(self, logger):
@@ -84,19 +76,10 @@ class OETestResult(_TestResult):
84 found = False 76 found = False
85 77
86 for (scase, msg) in getattr(self, type): 78 for (scase, msg) in getattr(self, type):
87 # XXX: When XML reporting is enabled scase is 79 if case.id() == scase.id():
88 # xmlrunner.result._TestInfo instance instead of 80 found = True
89 # string. 81 break
90 if xmlEnabled: 82 scase_str = str(scase.id())
91 if case.id() == scase.test_id:
92 found = True
93 break
94 scase_str = scase.test_id
95 else:
96 if case.id() == scase.id():
97 found = True
98 break
99 scase_str = str(scase.id())
100 83
101 # When fails at module or class level the class name is passed as string 84 # When fails at module or class level the class name is passed as string
102 # so figure out to see if match 85 # so figure out to see if match
@@ -167,33 +150,14 @@ class OETestRunner(_TestRunner):
167 streamLoggerClass = OEStreamLogger 150 streamLoggerClass = OEStreamLogger
168 151
169 def __init__(self, tc, *args, **kwargs): 152 def __init__(self, tc, *args, **kwargs):
170 if xmlEnabled:
171 if not kwargs.get('output'):
172 kwargs['output'] = os.path.join(os.getcwd(),
173 'TestResults_%s_%s' % (time.strftime("%Y%m%d%H%M%S"), os.getpid()))
174
175 kwargs['stream'] = self.streamLoggerClass(tc.logger) 153 kwargs['stream'] = self.streamLoggerClass(tc.logger)
176 super(OETestRunner, self).__init__(*args, **kwargs) 154 super(OETestRunner, self).__init__(*args, **kwargs)
177 self.tc = tc 155 self.tc = tc
178 self.resultclass = OETestResult 156 self.resultclass = OETestResult
179 157
180 # XXX: The unittest-xml-reporting package defines _make_result method instead 158 def _makeResult(self):
181 # of _makeResult standard on unittest. 159 return self.resultclass(self.tc, self.stream, self.descriptions,
182 if xmlEnabled: 160 self.verbosity)
183 def _make_result(self):
184 """
185 Creates a TestResult object which will be used to store
186 information about the executed tests.
187 """
188 # override in subclasses if necessary.
189 return self.resultclass(self.tc,
190 self.stream, self.descriptions, self.verbosity, self.elapsed_times
191 )
192 else:
193 def _makeResult(self):
194 return self.resultclass(self.tc, self.stream, self.descriptions,
195 self.verbosity)
196
197 161
198 def _walk_suite(self, suite, func): 162 def _walk_suite(self, suite, func):
199 for obj in suite: 163 for obj in suite: