1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 from unittest import TestResult
18 from buildbot.process import buildstep
19 from StringIO import StringIO
20
22 """Observe a log that may contain subunit output.
23
24 This class extends TestResult to receive the callbacks from the subunit
25 parser in the most direct fashion.
26 """
27
29 buildstep.LogLineObserver.__init__(self)
30 TestResult.__init__(self)
31 try:
32 from subunit import TestProtocolServer
33 except ImportError:
34 raise ImportError("subunit is not importable, but is required for "
35 "SubunitLogObserver support.")
36 self.warningio = StringIO()
37 self.protocol = TestProtocolServer(self, self.warningio)
38 self.skips = []
39 self.seen_tags = set()
40
42 """Process a received stdout line."""
43
44 self.protocol.lineReceived(line + '\n')
45
47 """same for stderr line."""
48 self.protocol.lineReceived(line + '\n')
49
53
59
63
67
69 """An issue - failing, erroring etc test."""
70 self.step.setProgress('tests failed', len(self.failures) +
71 len(self.errors))
72
76
77
78 import buildbot.steps.subunit
79 SubunitShellCommand = buildbot.steps.subunit.SubunitShellCommand
80