From 7e4762cf174fde675d5634c7e4addc350b75eab1 Mon Sep 17 00:00:00 2001 From: deveco_xdevice Date: Thu, 10 Oct 2024 20:55:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=A5=97=E7=94=9F=E6=88=90=E6=8A=A5=E5=91=8A=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: deveco_xdevice --- src/xdevice/_core/executor/abs.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/xdevice/_core/executor/abs.py b/src/xdevice/_core/executor/abs.py index 1c5a97c..91fe2c5 100644 --- a/src/xdevice/_core/executor/abs.py +++ b/src/xdevice/_core/executor/abs.py @@ -21,14 +21,14 @@ import re import stat import uuid from abc import ABC - from abc import abstractmethod from _core.plugin import Plugin from _core.plugin import get_plugin from _core.constants import TestType -from _core.executor.bean import SuiteResult from _core.executor.bean import CaseResult +from _core.executor.bean import SuiteResult +from _core.executor.bean import SuitesResult from _core.interface import LifeCycle from _core.interface import IListener from _core.report.suite_reporter import SuiteReporter @@ -205,8 +205,9 @@ class ReportEventListener(AbsReportListener, ABC): if not kwargs.get("suite_report", False): result_dir = os.path.join(self.report_path, "result") os.makedirs(result_dir, exist_ok=True) - message = "" - if test_result: + message = kwargs.get("message", "") + # 有的场景传SuiteResult对象进来,导致报错,需要增加实例判断 + if isinstance(test_result, SuitesResult): message = test_result.stacktrace suites_name = test_result.suites_name else: