Add help links to bot messages. (#28903)

pull/28905/head
Matt Clay 7 years ago committed by GitHub
parent e132918b92
commit 79dcb3a3fa

@ -261,9 +261,9 @@ class TestFailure(TestResult):
""" """
:type args: TestConfig :type args: TestConfig
""" """
message = self.format_title()
output = self.format_block()
docs = self.find_docs() docs = self.find_docs()
message = self.format_title(help_link=docs)
output = self.format_block()
if self.messages: if self.messages:
verified = all((m.confidence or 0) >= 50 for m in self.messages) verified = all((m.confidence or 0) >= 50 for m in self.messages)
@ -331,8 +331,9 @@ class TestFailure(TestResult):
return None return None
def format_title(self): def format_title(self, help_link=None):
""" """
:type help_link: str | None
:rtype: str :rtype: str
""" """
command = self.format_command() command = self.format_command()
@ -342,7 +343,12 @@ class TestFailure(TestResult):
else: else:
reason = 'error' if len(self.messages) == 1 else 'errors' reason = 'error' if len(self.messages) == 1 else 'errors'
title = 'The test `%s` failed with the following %s:' % (command, reason) if help_link:
help_link_markup = ' [[?](%s)]' % help_link
else:
help_link_markup = ''
title = 'The test `%s`%s failed with the following %s:' % (command, help_link_markup, reason)
return title return title

Loading…
Cancel
Save