def _getLegacySummary(self, done): # defer to the describe method, if set description = self.describe(done) if description: return join_list(description) # defer to descriptions, if they're set if (not done and self.description) or (done and self.descriptionDone): return None try: # if self.cmd is set, then use the RemoteCommand's info if self.cmd: command = self.cmd.remote_command # otherwise, if we were configured with a command, use that elif self.command: command = self.command else: return None rv = command_to_string(command) # add the descriptionSuffix, if one was given if self.descriptionSuffix: rv = rv + u' ' + join_list(self.descriptionSuffix) return rv except Exception: log.err(failure.Failure(), "Error describing step") return None
def getCurrentSummary(self): if self.description is not None: stepsumm = util.join_list(self.description) if self.descriptionSuffix: stepsumm += u' ' + util.join_list(self.descriptionSuffix) else: stepsumm = u'running' return {u'step': stepsumm}
def getCurrentSummary(self): if self.description is not None: stepsumm = util.join_list(self.description) if self.descriptionSuffix: stepsumm += u" " + util.join_list(self.descriptionSuffix) else: stepsumm = u"running" return {u"step": stepsumm}
def getCurrentSummary(self): if self.description is not None: stepsumm = util.join_list(self.description) if self.descriptionSuffix: stepsumm += ' ' + util.join_list(self.descriptionSuffix) else: stepsumm = 'running' return {'step': stepsumm}
def getResultSummary(self): if self.descriptionDone is not None or self.description is not None: stepsumm = util.join_list(self.descriptionDone or self.description) if self.descriptionSuffix: stepsumm += ' ' + util.join_list(self.descriptionSuffix) else: stepsumm = 'finished' if self.results != SUCCESS: stepsumm += ' ({})'.format(Results[self.results]) return {'step': stepsumm}
def getResultSummary(self): if self.descriptionDone is not None or self.description is not None: stepsumm = util.join_list(self.descriptionDone or self.description) if self.descriptionSuffix: stepsumm += u' ' + util.join_list(self.descriptionSuffix) else: stepsumm = u'finished' if self.results != SUCCESS: stepsumm += u' (%s)' % Results[self.results] return {u'step': stepsumm}
def getResultSummary(self): if self.descriptionDone is not None or self.description is not None: stepsumm = util.join_list(self.descriptionDone or self.description) if self.descriptionSuffix: stepsumm += u" " + util.join_list(self.descriptionSuffix) else: stepsumm = u"finished" if self.results != SUCCESS: stepsumm += u" (%s)" % Results[self.results] return {u"step": stepsumm}
def getResultSummary(self): description = [] if self.hasStatistic('tests-total'): total = self.getStatistic("tests-total", 0) failed = self.getStatistic("tests-failed", 0) passed = self.getStatistic("tests-passed", 0) warnings = self.getStatistic("tests-warnings", 0) if not total: total = failed + passed + warnings if total: description += [str(total), 'tests'] if passed: description += [str(passed), 'passed'] if warnings: description += [str(warnings), 'warnings'] if failed: description += [str(failed), 'failed'] if description: summary = join_list(description) if self.results != SUCCESS: summary += ' ({})'.format(Results[self.results]) return {'step': summary} return super().getResultSummary()
def describe(self, done=False): assert(self.rendered) desc = self._describe(done) if not desc: return None if self.descriptionSuffix: desc = desc + u' ' + join_list(self.descriptionSuffix) return desc
def describe(self, done=False): assert self.rendered desc = self._describe(done) if not desc: return None if self.descriptionSuffix: desc = desc + u" " + join_list(self.descriptionSuffix) return desc
def describe(self, done=False): # old-style steps expect this function to exist assert not self.isNewStyle() desc = self._describe(done) if not desc: return [] if self.descriptionSuffix: desc = desc + u' ' + util.join_list(self.descriptionSuffix) return desc
def describe(self, done=False): if self.stopped and not self.rendered: return u"stopped early" assert (self.rendered) desc = self._describe(done) if not desc: return None if self.descriptionSuffix: desc = desc + u' ' + join_list(self.descriptionSuffix) return desc
def describe(self, done=False): if self.stopped and not self.rendered: return u"stopped early" assert(self.rendered) desc = self._describe(done) if not desc: return None if self.descriptionSuffix: desc = desc + u' ' + join_list(self.descriptionSuffix) return desc
def build_results(self, cmd): counts = self.observer.counts total = counts['total'] failures = counts['failures'] errors = counts['errors'] parsed = (total is not None) desc_parts = [] if not cmd.didFail(): if parsed: results = SUCCESS if total: desc_parts += [ str(total), total == 1 and "test" or "tests", "passed" ] else: desc_parts += ["no tests", "run"] else: results = FAILURE desc_parts += ["testlog", "unparseable"] else: # something failed results = FAILURE if parsed: desc_parts += ["tests"] if failures: desc_parts += [ str(failures), failures == 1 and "failure" or "failures" ] if errors: desc_parts += [ str(errors), errors == 1 and "error" or "errors" ] else: desc_parts += ["tests", "failed"] if counts['skips']: desc_parts += [ str(counts['skips']), counts['skips'] == 1 and "skip" or "skips" ] if counts['expectedFailures']: desc_parts += [ str(counts['expectedFailures']), "todo" if counts['expectedFailures'] == 1 else "todos" ] if self.reactor: desc_parts.append(self.rtext('({})')) self.descriptionDone = util.join_list(desc_parts) return results
def test_list(self): self.assertEqual(util.join_list(['aa', 'bb']), u'aa bb')
def test_nonascii(self): with self.assertRaises(UnicodeDecodeError): util.join_list([b'\xff'])
def test_nonascii(self): self.assertRaises(UnicodeDecodeError, lambda: util.join_list(['\xff']))
def test_unicode(self): self.assertEqual(util.join_list(u'abc'), u'abc')
def test_string(self): self.assertEqual(util.join_list('abc'), u'abc')
def test_tuple(self): self.assertEqual(util.join_list(('aa', 'bb')), u'aa bb')