(test, test_count, duration)
| 97 | |
| 98 | |
| 99 | def process_failures(test, test_count, duration): |
| 100 | bad_page_image = "failure_%s.png" % test_count |
| 101 | bad_page_data = "failure_%s.txt" % test_count |
| 102 | screenshot_path = os.path.join(LATEST_REPORT_DIR, bad_page_image) |
| 103 | if getattr(test, "_last_page_screenshot", None): |
| 104 | with open(screenshot_path, mode="wb") as file: |
| 105 | file.write(test._last_page_screenshot) |
| 106 | save_test_failure_data(test, bad_page_data, folder=LATEST_REPORT_DIR) |
| 107 | exc_message = None |
| 108 | if hasattr(test, "_outcome") and getattr(test._outcome, "errors", None): |
| 109 | try: |
| 110 | exc_message = test._outcome.errors[-1][1][1] |
| 111 | except Exception: |
| 112 | exc_message = "(Unknown Exception)" |
| 113 | else: |
| 114 | try: |
| 115 | exc_message = sys.last_value |
| 116 | except Exception: |
| 117 | exc_message = "(Unknown Exception)" |
| 118 | if not hasattr(test, "_last_page_url"): |
| 119 | test._last_page_url = "about:blank" |
| 120 | return '"%s","%s","%s","%s","%s","%s","%s","%s","%s","%s"' % ( |
| 121 | test_count, |
| 122 | "FAILED!", |
| 123 | bad_page_data, |
| 124 | bad_page_image, |
| 125 | test._last_page_url, |
| 126 | test.browser, |
| 127 | get_timestamp()[:-3], |
| 128 | duration, |
| 129 | test.id(), |
| 130 | exc_message, |
| 131 | ) |
| 132 | |
| 133 | |
| 134 | def clear_out_old_report_logs(archive_past_runs=True, get_log_folder=False): |
nothing calls this directly
no test coverage detected
searching dependent graphs…