From 79dcb3a3fa3b15f1405d59352435f3b30ffe12e7 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 31 Aug 2017 16:39:37 -0700 Subject: [PATCH] Add help links to bot messages. (#28903) --- test/runner/lib/test.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/runner/lib/test.py b/test/runner/lib/test.py index 2266fd849b4..0e163a99f9f 100644 --- a/test/runner/lib/test.py +++ b/test/runner/lib/test.py @@ -261,9 +261,9 @@ class TestFailure(TestResult): """ :type args: TestConfig """ - message = self.format_title() - output = self.format_block() docs = self.find_docs() + message = self.format_title(help_link=docs) + output = self.format_block() if self.messages: verified = all((m.confidence or 0) >= 50 for m in self.messages) @@ -331,8 +331,9 @@ class TestFailure(TestResult): return None - def format_title(self): + def format_title(self, help_link=None): """ + :type help_link: str | None :rtype: str """ command = self.format_command() @@ -342,7 +343,12 @@ class TestFailure(TestResult): else: 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