From 4c3280dc306434fb88bd504af155e384cbd68612 Mon Sep 17 00:00:00 2001 From: floraachy <1622042529@qq.com> Date: Fri, 15 Aug 2025 16:42:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9allure=20html=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E4=BF=9D=E5=AD=98=E6=96=B9=E5=BC=8F=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=AF=8F=E6=AC=A1=E6=89=A7=E8=A1=8C=E7=9A=84html?= =?UTF-8?q?=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common | 2 +- run.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common b/common index d572874..a6beecb 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit d572874a99cb7643119c9be7cb01ce7a4a315d97 +Subproject commit a6beecbbd05ffdfa8364e142e6b6a1d621bd14b3 diff --git a/run.py b/run.py index 804b4bb..2aafa5c 100644 --- a/run.py +++ b/run.py @@ -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)