修改allure html报告保存方式,保存每次执行的html报告

This commit is contained in:
floraachy
2025-08-15 16:42:13 +08:00
parent 6b94170bb3
commit 4c3280dc30
2 changed files with 6 additions and 3 deletions

2
common

Submodule common updated: d572874a99...a6beecbbd0

7
run.py
View File

@@ -35,6 +35,7 @@ pytest相关参数以下也可通过pytest.ini配置
# 标准库导入
import os
import shutil
import time
# 第三方库导入
import pytest
from loguru import logger
@@ -95,15 +96,17 @@ def run(env, m, report):
pytest.main(args=arg_list)
# ------------------------ 生成测试报告 ------------------------
if report == "yes":
_ALLURE_HTML_DIR = f"{ALLURE_HTML_DIR}_{str(int(round(time.time() * 1000)))}"
logger.debug("ALLURE HTML DIR: {}".format(_ALLURE_HTML_DIR))
report_path, attachment_path = generate_allure_report(allure_results=ALLURE_RESULTS_DIR,
allure_report=ALLURE_HTML_DIR,
allure_report=_ALLURE_HTML_DIR,
windows_title=REPORT["项目名称"],
report_name=REPORT["报告标题"],
env_info={
"运行环境": GLOBAL_VARS.get("host", None)},
allure_config_path=ALLURE_CONFIG_DIR,
attachment_path=os.path.join(REPORT_DIR,
f'autotest_report.zip'))
f'{_ALLURE_HTML_DIR}.zip'))
# ------------------------ 发送测试结果 ------------------------
send_result(report_info=REPORT, report_path=report_path, attachment_path=attachment_path)