def write_results(log, results, iterations, pr_number=None, use_details=False): log("## All results ##\n") if use_details: log("<details>\n") log("<summary>%i %s ran</summary>\n\n" % (len(results), "tests" if len(results) > 1 else "test")) for test_name, test in results.iteritems(): baseurl = "http://w3c-test.org/submissions" if "https" in os.path.splitext(test_name)[0].split(".")[1:]: baseurl = "https://w3c-test.org/submissions" title = test_name if use_details: log("<details>\n") if pr_number: title = "<a href=\"%s/%s%s\">%s</a>" % (baseurl, pr_number, test_name, title) log('<summary>%s</summary>\n\n' % title) else: log("### %s ###" % title) strings = [("", err_string(test["status"], iterations), "")] strings.extend( ((("`%s`" % markdown_adjust(subtest_name)) if subtest else "", err_string(subtest["status"], iterations), ("`%s`" % markdown_adjust(';'.join(subtest["messages"]))) if len(subtest["messages"]) else "") for subtest_name, subtest in test["subtests"].items())) table(["Subtest", "Results", "Messages"], strings, log) if use_details: log("</details>\n") if use_details: log("</details>\n")
def write_results(log, results, iterations, pr_number=None, use_details=False): log("## All results ##\n") if use_details: log("<details>\n") log("<summary>%i %s ran</summary>\n\n" % (len(results), "tests" if len(results) > 1 else "test")) for test_name, test in results.iteritems(): baseurl = "http://w3c-test.org/submissions" if "https" in os.path.splitext(test_name)[0].split(".")[1:]: baseurl = "https://w3c-test.org/submissions" title = test_name if use_details: log("<details>\n") if pr_number: title = "<a href=\"%s/%s%s\">%s</a>" % (baseurl, pr_number, test_name, title) log('<summary>%s</summary>\n\n' % title) else: log("### %s ###" % title) strings = [("", err_string(test["status"], iterations), "")] strings.extend((( ("`%s`" % markdown_adjust(subtest_name)) if subtest else "", err_string(subtest["status"], iterations), ("`%s`" % markdown_adjust(';'.join(subtest["messages"]))) if len(subtest["messages"]) else "") for subtest_name, subtest in test["subtests"].items())) table(["Subtest", "Results", "Messages"], strings, log) if use_details: log("</details>\n") if use_details: log("</details>\n")
def write_inconsistent(log, inconsistent, iterations): """Output inconsistent tests to logger.error.""" log("## Unstable results ##\n") strings = [("`%s`" % markdown_adjust(test), ("`%s`" % markdown_adjust(subtest)) if subtest else "", err_string(results, iterations), ("`%s`" % markdown_adjust(";".join(messages))) if len(messages) else "") for test, subtest, results, messages in inconsistent] table(["Test", "Subtest", "Results", "Messages"], strings, log)
def write_inconsistent(log, inconsistent, iterations): """Output inconsistent tests to logger.error.""" log("## Unstable results ##\n") strings = [( "`%s`" % markdown_adjust(test), ("`%s`" % markdown_adjust(subtest)) if subtest else "", err_string(results, iterations), ("`%s`" % markdown_adjust(";".join(messages))) if len(messages) else "") for test, subtest, results, messages in inconsistent] table(["Test", "Subtest", "Results", "Messages"], strings, log)
def write_slow_tests(log, slow): log("## Slow tests ##\n") strings = [("`%s`" % markdown_adjust(test), "`%s`" % status, "`%.0f`" % duration, "`%.0f`" % timeout) for test, status, duration, timeout in slow] table(["Test", "Result", "Longest duration (ms)", "Timeout (ms)"], strings, log)
def write_slow_tests(log, slow): log("## Slow tests ##\n") strings = [( "`%s`" % markdown_adjust(test), "`%s`" % status, "`%.0f`" % duration, "`%.0f`" % timeout) for test, status, duration, timeout in slow] table(["Test", "Result", "Longest duration (ms)", "Timeout (ms)"], strings, log)