Trees | Indices | Help |
|
---|
|
1 # This file is part of Buildbot. Buildbot is free software: you can 2 # redistribute it and/or modify it under the terms of the GNU General Public 3 # License as published by the Free Software Foundation, version 2. 4 # 5 # This program is distributed in the hope that it will be useful, but WITHOUT 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 8 # details. 9 # 10 # You should have received a copy of the GNU General Public License along with 11 # this program; if not, write to the Free Software Foundation, Inc., 51 12 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 13 # 14 # Copyright Buildbot Team Members 15 16 17 from buildbot.steps.shell import ShellCommand 18 from buildbot.status.builder import SUCCESS, FAILURE 1921 """A ShellCommand that sniffs subunit output. 22 """ 239425 ShellCommand.__init__(self, *args, **kwargs) 26 # importing here gets around an import loop 27 from buildbot.process import subunitlogobserver 28 self.ioObverser = subunitlogobserver.SubunitLogObserver() 29 self.addLogObserver('stdio', self.ioObverser) 30 self.progressMetrics = self.progressMetrics + ('tests', 'tests failed')32 # figure out all statistics about the run 33 ob = self.ioObverser 34 failures = len(ob.failures) 35 errors = len(ob.errors) 36 skips = len(ob.skips) 37 total = ob.testsRun 38 39 count = failures + errors 40 41 text = [self.name] 42 text2 = "" 43 44 if not count: 45 results = SUCCESS 46 if total: 47 text += ["%d %s" % \ 48 (total, 49 total == 1 and "test" or "tests"), 50 "passed"] 51 else: 52 text += ["no tests", "run"] 53 else: 54 results = FAILURE 55 if failures: 56 text.append("%d %s" % \ 57 (failures, 58 failures == 1 and "failure" or "failures")) 59 if errors: 60 text.append("%d %s" % \ 61 (errors, 62 errors == 1 and "error" or "errors")) 63 text2 = "%d tes%s" % (count, (count == 1 and 't' or 'ts')) 64 65 66 if skips: 67 text.append("%d %s" % (skips, 68 skips == 1 and "skip" or "skips")) 69 70 #TODO: expectedFailures/unexpectedSuccesses 71 72 self.results = results 73 self.text = text 74 self.text2 = [text2]7577 return self.results7880 ob = self.ioObverser 81 problems = "" 82 for test, err in ob.errors + ob.failures: 83 problems += "%s\n%s" % (test.id(), err) 84 if problems: 85 self.addCompleteLog("problems", problems) 86 warnings = ob.warningio.getvalue() 87 if warnings: 88 self.addCompleteLog("warnings", warnings)8991 return self.text93 return self.text2
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Dec 19 18:26:50 2010 | http://epydoc.sourceforge.net |