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 getResultSummary(self): if self.descriptionDone is not None: return super().getResultSummary() summary = util.command_to_string(self.command) if summary: if self.results != SUCCESS: summary += ' ({})'.format(Results[self.results]) return {'step': summary} return super().getResultSummary()
def getResultSummary(self): summary = util.command_to_string(self.command) if not summary: return super(ShellMixin, self).getResultSummary() return {u'step': summary}
def test_invalid_ascii(self): self.assertEqual(util.command_to_string('a\xffc'), u"'a\ufffdc'")
def test_list_with_objects(self): # the object looks like a renderable, and is skipped self.assertEqual(util.command_to_string(['ab', object(), 'cd']), u"'ab cd'")
def test_object(self): # this looks like a renderable self.assertEqual(util.command_to_string(object()), None)
def test_nested_list(self): self.assertEqual(util.command_to_string(['ab', ['cd', ['ef']]]), u"'ab cd ...'")
def test_long_string(self): self.assertEqual(util.command_to_string("ab cd ef"), u"'ab cd ...'")
def test_list(self): self.assertEqual(util.command_to_string(['ab', 'cd', 'ef']), "'ab cd ...'")
def test_short_string(self): self.assertEqual(util.command_to_string("ab cd"), u"'ab cd'")