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