From 0a2af1b0276bf1cb28a21711cb752146e3389283 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 19 Mar 2019 10:12:42 -0300 Subject: [PATCH] validate:launcher: Add generated known issue list to the logs instead of printing then --- validate/launcher/baseclasses.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py index 3e30fa6..5c28437 100644 --- a/validate/launcher/baseclasses.py +++ b/validate/launcher/baseclasses.py @@ -286,6 +286,18 @@ class Test(Loggable): with open(self.logfile, 'a') as f: f.write(info) + def add_known_issue_information(self): + info = "\n\n**You can mark the issues as 'known' by adding the " \ + + " following lines to the list of known issues**\n" \ + + "\n\n``` python\n%s\n```" % (self.generate_expected_issues()) + + if self.options.redirect_logs: + print(info) + return + + with open(self.logfile, 'a') as f: + f.write(info) + def set_result(self, result, message="", error=""): if not self.options.redirect_logs: @@ -314,6 +326,9 @@ class Test(Loggable): self.message = message self.error_str = error + if result not in [Result.PASSED, Result.NOT_RUN]: + self.add_known_issue_information() + def check_results(self): if self.result is Result.FAILED or self.result is Result.TIMEOUT: return @@ -1934,16 +1949,6 @@ class _TestsLauncher(Loggable): else: return self._run_tests() finally: - all_known_issues = "" - for test in self.tests: - if test.result not in [Result.PASSED, Result.NOT_RUN]: - known_issues = test.generate_expected_issues() - if known_issues: - all_known_issues += known_issues - if all_known_issues: - printc("\nSome tests failed, you might want to add the following" - " known issues to the testsuites and REPORT BUGS:\n", color=Colors.HEADER) - print(all_known_issues) if self.httpsrv: self.httpsrv.stop() if self.vfb_server: -- 2.7.4