diff options
-rw-r--r-- | meta/lib/oeqa/core/utils/concurrencytest.py | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/meta/lib/oeqa/core/utils/concurrencytest.py b/meta/lib/oeqa/core/utils/concurrencytest.py index 535b11e2d9..6bf7718863 100644 --- a/meta/lib/oeqa/core/utils/concurrencytest.py +++ b/meta/lib/oeqa/core/utils/concurrencytest.py | |||
@@ -21,6 +21,7 @@ import testtools | |||
21 | import threading | 21 | import threading |
22 | import time | 22 | import time |
23 | import io | 23 | import io |
24 | import subunit | ||
24 | 25 | ||
25 | from queue import Queue | 26 | from queue import Queue |
26 | from itertools import cycle | 27 | from itertools import cycle |
@@ -53,10 +54,11 @@ class BBThreadsafeForwardingResult(ThreadsafeForwardingResult): | |||
53 | def _add_result_with_semaphore(self, method, test, *args, **kwargs): | 54 | def _add_result_with_semaphore(self, method, test, *args, **kwargs): |
54 | self.semaphore.acquire() | 55 | self.semaphore.acquire() |
55 | try: | 56 | try: |
56 | self.result.starttime[test.id()] = self._test_start.timestamp() | 57 | if self._test_start: |
57 | self.result.threadprogress[self.threadnum].append(test.id()) | 58 | self.result.starttime[test.id()] = self._test_start.timestamp() |
58 | totalprogress = sum(len(x) for x in self.result.threadprogress.values()) | 59 | self.result.threadprogress[self.threadnum].append(test.id()) |
59 | self.result.progressinfo[test.id()] = "%s: %s/%s %s/%s (%ss) (%s)" % ( | 60 | totalprogress = sum(len(x) for x in self.result.threadprogress.values()) |
61 | self.result.progressinfo[test.id()] = "%s: %s/%s %s/%s (%ss) (%s)" % ( | ||
60 | self.threadnum, | 62 | self.threadnum, |
61 | len(self.result.threadprogress[self.threadnum]), | 63 | len(self.result.threadprogress[self.threadnum]), |
62 | self.totalinprocess, | 64 | self.totalinprocess, |
@@ -69,6 +71,23 @@ class BBThreadsafeForwardingResult(ThreadsafeForwardingResult): | |||
69 | super(BBThreadsafeForwardingResult, self)._add_result_with_semaphore(method, test, *args, **kwargs) | 71 | super(BBThreadsafeForwardingResult, self)._add_result_with_semaphore(method, test, *args, **kwargs) |
70 | 72 | ||
71 | # | 73 | # |
74 | # We have to patch subunit since it doesn't understand how to handle addError | ||
75 | # outside of a running test case. This can happen if classSetUp() fails | ||
76 | # for a class of tests. This unfortunately has horrible internal knowledge. | ||
77 | # | ||
78 | def outSideTestaddError(self, offset, line): | ||
79 | """An 'error:' directive has been read.""" | ||
80 | test_name = line[offset:-1].decode('utf8') | ||
81 | self.parser._current_test = subunit.RemotedTestCase(test_name) | ||
82 | self.parser.current_test_description = test_name | ||
83 | self.parser._state = self.parser._reading_error_details | ||
84 | self.parser._reading_error_details.set_simple() | ||
85 | self.parser.subunitLineReceived(line) | ||
86 | |||
87 | subunit._OutSideTest.addError = outSideTestaddError | ||
88 | |||
89 | |||
90 | # | ||
72 | # A dummy structure to add to io.StringIO so that the .buffer object | 91 | # A dummy structure to add to io.StringIO so that the .buffer object |
73 | # is available and accepts writes. This allows unittest with buffer=True | 92 | # is available and accepts writes. This allows unittest with buffer=True |
74 | # to interact ok with subunit which wants to access sys.stdout.buffer. | 93 | # to interact ok with subunit which wants to access sys.stdout.buffer. |