diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-13 13:13:10 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-12-16 14:31:27 +0000 |
commit | 52fba040681820ab036c091acadfbecf58357297 (patch) | |
tree | 096d7a74fdb140dd6b4d9d17b46af85a76fbf107 /meta/lib/oeqa/core | |
parent | d8dc75de8b62b08a77cb2915bdc9c3f9f2f37239 (diff) | |
download | poky-52fba040681820ab036c091acadfbecf58357297.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)
(From OE-Core rev: 02449e89d62a7714d30ab6e2e58c476dc9441f7a)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/core')
-rw-r--r-- | meta/lib/oeqa/core/runner.py | 54 |
1 files changed, 9 insertions, 45 deletions
diff --git a/meta/lib/oeqa/core/runner.py b/meta/lib/oeqa/core/runner.py index 50122f22b1..429c216a69 100644 --- a/meta/lib/oeqa/core/runner.py +++ b/meta/lib/oeqa/core/runner.py | |||
@@ -7,16 +7,8 @@ import unittest | |||
7 | import logging | 7 | import logging |
8 | import re | 8 | import re |
9 | 9 | ||
10 | xmlEnabled = False | 10 | from unittest import TextTestResult as _TestResult |
11 | try: | 11 | from 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 | ||
16 | except ImportError: | ||
17 | # use the base runner instead | ||
18 | from unittest import TextTestResult as _TestResult | ||
19 | from unittest import TextTestRunner as _TestRunner | ||
20 | 12 | ||
21 | class OEStreamLogger(object): | 13 | class OEStreamLogger(object): |
22 | def __init__(self, logger): | 14 | def __init__(self, logger): |
@@ -77,19 +69,10 @@ class OETestResult(_TestResult): | |||
77 | found = False | 69 | found = False |
78 | 70 | ||
79 | for (scase, msg) in getattr(self, type): | 71 | for (scase, msg) in getattr(self, type): |
80 | # XXX: When XML reporting is enabled scase is | 72 | if case.id() == scase.id(): |
81 | # xmlrunner.result._TestInfo instance instead of | 73 | found = True |
82 | # string. | 74 | break |
83 | if xmlEnabled: | 75 | scase_str = str(scase.id()) |
84 | if case.id() == scase.test_id: | ||
85 | found = True | ||
86 | break | ||
87 | scase_str = scase.test_id | ||
88 | else: | ||
89 | if case.id() == scase.id(): | ||
90 | found = True | ||
91 | break | ||
92 | scase_str = str(scase.id()) | ||
93 | 76 | ||
94 | # When fails at module or class level the class name is passed as string | 77 | # When fails at module or class level the class name is passed as string |
95 | # so figure out to see if match | 78 | # so figure out to see if match |
@@ -156,33 +139,14 @@ class OETestRunner(_TestRunner): | |||
156 | streamLoggerClass = OEStreamLogger | 139 | streamLoggerClass = OEStreamLogger |
157 | 140 | ||
158 | def __init__(self, tc, *args, **kwargs): | 141 | def __init__(self, tc, *args, **kwargs): |
159 | if xmlEnabled: | ||
160 | if not kwargs.get('output'): | ||
161 | kwargs['output'] = os.path.join(os.getcwd(), | ||
162 | 'TestResults_%s_%s' % (time.strftime("%Y%m%d%H%M%S"), os.getpid())) | ||
163 | |||
164 | kwargs['stream'] = self.streamLoggerClass(tc.logger) | 142 | kwargs['stream'] = self.streamLoggerClass(tc.logger) |
165 | super(OETestRunner, self).__init__(*args, **kwargs) | 143 | super(OETestRunner, self).__init__(*args, **kwargs) |
166 | self.tc = tc | 144 | self.tc = tc |
167 | self.resultclass = OETestResult | 145 | self.resultclass = OETestResult |
168 | 146 | ||
169 | # XXX: The unittest-xml-reporting package defines _make_result method instead | 147 | def _makeResult(self): |
170 | # of _makeResult standard on unittest. | 148 | return self.resultclass(self.tc, self.stream, self.descriptions, |
171 | if xmlEnabled: | 149 | self.verbosity) |
172 | def _make_result(self): | ||
173 | """ | ||
174 | Creates a TestResult object which will be used to store | ||
175 | information about the executed tests. | ||
176 | """ | ||
177 | # override in subclasses if necessary. | ||
178 | return self.resultclass(self.tc, | ||
179 | self.stream, self.descriptions, self.verbosity, self.elapsed_times | ||
180 | ) | ||
181 | else: | ||
182 | def _makeResult(self): | ||
183 | return self.resultclass(self.tc, self.stream, self.descriptions, | ||
184 | self.verbosity) | ||
185 | |||
186 | 150 | ||
187 | def _walk_suite(self, suite, func): | 151 | def _walk_suite(self, suite, func): |
188 | for obj in suite: | 152 | for obj in suite: |