1
2
3 from unittest import TestResult
4 from buildbot.process import buildstep
5 from StringIO import StringIO
6
8 """Observe a log that may contain subunit output.
9
10 This class extends TestResult to receive the callbacks from the subunit
11 parser in the most direct fashion.
12 """
13
15 buildstep.LogLineObserver.__init__(self)
16 TestResult.__init__(self)
17 try:
18 from subunit import TestProtocolServer
19 except ImportError:
20 raise ImportError("subunit is not importable, but is required for "
21 "SubunitLogObserver support.")
22 self.warningio = StringIO()
23 self.protocol = TestProtocolServer(self, self.warningio)
24 self.skips = []
25 self.seen_tags = set()
26
28 """Process a received stdout line."""
29
30 self.protocol.lineReceived(line + '\n')
31
33 """same for stderr line."""
34 self.protocol.lineReceived(line + '\n')
35
39
45
49
53
55 """An issue - failing, erroring etc test."""
56 self.step.setProgress('tests failed', len(self.failures) +
57 len(self.errors))
58
62
63
64 import buildbot.steps.subunit
65 SubunitShellCommand = buildbot.steps.subunit.SubunitShellCommand
66