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.results import SUCCESS, FAILURE 1921 """A ShellCommand that sniffs subunit output. 22 """ 2310325 ShellCommand.__init__(self, *args, **kwargs) 26 self.failureOnNoTests = failureOnNoTests 27 28 # importing here gets around an import loop 29 from buildbot.process import subunitlogobserver 30 31 self.ioObverser = subunitlogobserver.SubunitLogObserver() 32 self.addLogObserver('stdio', self.ioObverser) 33 self.progressMetrics = self.progressMetrics + ('tests', 'tests failed')3436 # figure out all statistics about the run 37 ob = self.ioObverser 38 failures = len(ob.failures) 39 errors = len(ob.errors) 40 skips = len(ob.skips) 41 total = ob.testsRun 42 43 count = failures + errors 44 45 text = [self.name] 46 text2 = "" 47 48 if not count: 49 results = SUCCESS 50 if total: 51 text += ["%d %s" % \ 52 (total, 53 total == 1 and "test" or "tests"), 54 "passed"] 55 else: 56 if self.failureOnNoTests: 57 results = FAILURE 58 text += ["no tests", "run"] 59 else: 60 results = FAILURE 61 text.append("Total %d test(s)" % total) 62 if failures: 63 text.append("%d %s" % \ 64 (failures, 65 failures == 1 and "failure" or "failures")) 66 if errors: 67 text.append("%d %s" % \ 68 (errors, 69 errors == 1 and "error" or "errors")) 70 text2 = "%d %s" % (count, (count == 1 and 'test' or 'tests')) 71 72 73 if skips: 74 text.append("%d %s" % (skips, 75 skips == 1 and "skip" or "skips")) 76 77 #TODO: expectedFailures/unexpectedSuccesses 78 79 self.results = results 80 self.text = text 81 self.text2 = [text2]82 8789 ob = self.ioObverser 90 problems = "" 91 for test, err in ob.errors + ob.failures: 92 problems += "%s\n%s" % (test.id(), err) 93 if problems: 94 self.addCompleteLog("problems", problems) 95 warnings = ob.warningio.getvalue() 96 if warnings: 97 self.addCompleteLog("warnings", warnings)98100 return self.text102 return self.text2
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Nov 21 16:22:53 2012 | http://epydoc.sourceforge.net |