From 0767aacf0acb271092485b12e658dd0e366df4f0 Mon Sep 17 00:00:00 2001 From: dustin Date: Sat, 6 Sep 2008 05:59:09 +0100 Subject: [PATCH] (closes #332) append the test summary to the description rather than replacing it --- buildbot/steps/shell.py | 41 ++++++++++++++++++--------------- buildbot/steps/shell.py.rej | 56 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 19 deletions(-) create mode 100644 buildbot/steps/shell.py.rej diff --git a/buildbot/steps/shell.py b/buildbot/steps/shell.py index 2108d77..92c7419 100644 --- a/buildbot/steps/shell.py +++ b/buildbot/steps/shell.py @@ -382,25 +382,28 @@ class Test(WarningCountingShellCommand): passed += self.step_status.getStatistic('tests-passed', 0) self.step_status.setStatistic('tests-passed', passed) - def getText(self, cmd, results): - text = WarningCountingShellCommand.getText(self, cmd, results) - if self.step_status.hasStatistic('tests-total'): - total = self.step_status.getStatistic("tests-total", 0) - failed = self.step_status.getStatistic("tests-failed", 0) - passed = self.step_status.getStatistic("tests-passed", 0) - warnings = self.step_status.getStatistic("tests-warnings", 0) - if not total: - total = failed + passed + warnings - - if total: - text.append('%d tests' % total) - if passed: - text.append('%d passed' % passed) - if warnings: - text.append('%d warnings' % warnings) - if failed: - text.append('%d failed' % failed) - return text + def describe(self, done=False): + description = WarningCountingShellCommand.describe(self, done) + if done: + if self.step_status.hasStatistic('tests-total'): + total = self.step_status.getStatistic("tests-total", 0) + failed = self.step_status.getStatistic("tests-failed", 0) + passed = self.step_status.getStatistic("tests-passed", 0) + warnings = self.step_status.getStatistic("tests-warnings", 0) + if not total: + total = failed + passed + warnings + + if total: + description.append('%d tests' % total) + if passed: + description.append('%d passed' % passed) + if warnings: + description.append('%d warnings' % warnings) + if failed: + description.append('%d failed' % failed) + else: + description.append("no test results") + return description class PerlModuleTest(Test): command=["prove", "--lib", "lib", "-r", "t"] diff --git a/buildbot/steps/shell.py.rej b/buildbot/steps/shell.py.rej new file mode 100644 index 0000000..f91595a --- /dev/null +++ b/buildbot/steps/shell.py.rej @@ -0,0 +1,56 @@ +*************** +*** 382,406 **** + passed += self.step_status.getStatistic('tests-passed', 0) + self.step_status.setStatistic('tests-passed', passed) + +- def getText(self, cmd, results): +- text = WarningCountingShellCommand.getText(self, cmd, results) +- if self.step_status.hasStatistic('tests-total'): +- total = self.step_status.getStatistic("tests-total", 0) +- failed = self.step_status.getStatistic("tests-failed", 0) +- passed = self.step_status.getStatistic("tests-passed", 0) +- warnings = self.step_status.getStatistic("tests-warnings", 0) +- if not total: +- total = failed + passed + warnings +- +- if total: +- text.append('%d tests' % total) +- if passed: +- text.append('%d passed' % passed) +- if warnings: +- text.append('%d warnings' % warnings) +- if failed: +- text.append('%d failed' % failed) +- return text + + class PerlModuleTest(Test): + command=["prove", "--lib", "lib", "-r", "t"] +--- 382,409 ---- + passed += self.step_status.getStatistic('tests-passed', 0) + self.step_status.setStatistic('tests-passed', passed) + ++ def describe(self, done=False): ++ description = WarningCountingShellCommand.describe(self, done) ++ if done: ++ if self.step_status.hasStatistic('tests-total'): ++ total = self.step_status.getStatistic("tests-total", 0) ++ failed = self.step_status.getStatistic("tests-failed", 0) ++ passed = self.step_status.getStatistic("tests-passed", 0) ++ warnings = self.step_status.getStatistic("tests-warnings", 0) ++ if not total: ++ total = failed + passed + warnings ++ ++ if total: ++ description.append('%d tests' % total) ++ if passed: ++ description.append('%d passed' % passed) ++ if warnings: ++ description.append('%d warnings' % warnings) ++ if failed: ++ description.append('%d failed' % failed) ++ else: ++ description.append("no test results") ++ return description + + class PerlModuleTest(Test): + command=["prove", "--lib", "lib", "-r", "t"] -- 2.11.4.GIT