def pytest_terminal_summary(terminalreporter, exitstatus, config): """收集测试结果""" result = { "total": terminalreporter._numcollected, 'passed': len(terminalreporter.stats.get('passed', [])), 'failed': len(terminalreporter.stats.get('failed', [])), 'error': len(terminalreporter.stats.get('error', [])), 'skipped': len(terminalreporter.stats.get('skipped', [])), # terminalreporter._sessionstarttime 会话开始时间 'total times': timestamp() - terminalreporter._sessionstarttime } print(result)
def crop_image(self, rect: list): """局部截图 :param rect = [x_min, y_min, x_max ,y_max]. :return filepath 图片路径 """ # 局部截图 img = G.DEVICE.snapshot() crop_screen = crop_image(img, rect) # 生成截图路径 filename = "%(time)d.jpg" % {'time': timestamp() * 1000} filepath = os.path.join(ST.LOG_DIR, filename) # 保存局部截图到logs文件夹中 pil_image = cv2_2_pil(crop_screen) pil_image.save(filepath, quality=99, optimize=True) return filepath