def pytest_sessionfinish(self, session): """ called after whole test run finished, right before returning the exit status to the system. :param _pytest.main.Session session: the pytest session object. :param int exitstatus: the status which pytest will return to the system. """ for test in self.completed_tests: if test.outcome == "FAILED" or test.outcome == "ERROR": self.clean_run = False self.end_time = time.time() update_run_index(self, True) footer = create_footer(self) result = footer.print_report_footer() create_run_log(self) logger.info("\n" + "Test session {} complete".format( session.name).center(shutil.get_terminal_size().columns, "-")) if core_args.email: try: submit_email_report(self, result) except SyntaxError: logger.error( "Problem with email report - check config file for correct values." )
def create_ci_report(self): footer = create_footer(self) results = footer.print_report_footer() lines = results.split('\n') result_str = '' for line in lines: if 'Passed:' in line and 'Total time:' in line: result_str = line ci_report_str = 'TinderboxPrint: Iris Summary<br/>%s\n' % result_str for test in self.completed_tests: if test.outcome == 'FAILED' or test.outcome == 'ERROR': fail_str = 'FAIL' if 'FAIL' in test.outcome else 'ERROR' local_test_dir = '%stests%s' % (os.sep, os.sep) local_path = test.file_name.split(local_test_dir)[1] temp_path = local_path.split(os.sep) test_name = temp_path.pop() temp_path.pop(0) ci_report_str += 'TEST-UNEXPECTED-%s | ' % fail_str for section in temp_path: ci_report_str += '%s | ' % section ci_report_str += '%s | %s\n' % (test_name, test.message) logger.info('CI Test results:\n%s' % ci_report_str)
def create_ci_report(self): footer = create_footer(self) results = footer.print_report_footer() lines = results.split("\n") result_str = "" for line in lines: if "Passed:" in line and "Total time:" in line: result_str = line ci_report_str = "TinderboxPrint: Iris Summary<br/>%s\n" % result_str for test in self.completed_tests: if test.outcome == "FAILED" or test.outcome == "ERROR": fail_str = "FAIL" if "FAIL" in test.outcome else "ERROR" local_test_dir = "%stests%s" % (os.sep, os.sep) local_path = test.file_name.split(local_test_dir)[1] temp_path = local_path.split(os.sep) test_name = temp_path.pop() temp_path.pop(0) ci_report_str += "TEST-UNEXPECTED-%s | " % fail_str for section in temp_path: ci_report_str += "%s | " % section ci_report_str += "%s | %s\n" % (test_name, test.message) logger.info("CI Test results:\n%s" % ci_report_str)