From fe23388b2267d3121079a8dc5c02ff0ee914b400 Mon Sep 17 00:00:00 2001 From: Lili Deng Date: Fri, 15 Nov 2024 15:34:06 +0800 Subject: [PATCH] not get env info if reuse previous env --- lisa/testsuite.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lisa/testsuite.py b/lisa/testsuite.py index 1e6dbedabd..0f69e9e25c 100644 --- a/lisa/testsuite.py +++ b/lisa/testsuite.py @@ -119,8 +119,7 @@ def environment_information(self) -> Dict[str, Any]: return self._environment_information @hookspec - def update_test_result_message(self, message: TestResultMessage) -> None: - ... + def update_test_result_message(self, message: TestResultMessage) -> None: ... def handle_exception( self, exception: Exception, log: Logger, phase: str = "" @@ -290,7 +289,16 @@ def _send_result_message(self, stacktrace: Optional[str] = None) -> None: # force refresh information, when test result status is changed. The # refreshed information is not used so far. But in case it's needed # in future, keep it up to date. - self._environment_information = self.environment.get_information() + force_run = True + if ( + result_message.status == TestResult.status.RUNNING + and not self.environment.is_new + ): + force_run = False + + self._environment_information = self.environment.get_information( + force_run=force_run + ) self.information.update(self._environment_information) self.information["environment"] = self.environment.name @@ -601,11 +609,9 @@ def __init__( self._should_stop = False self.__log = get_logger("suite", metadata.name) - def before_case(self, log: Logger, **kwargs: Any) -> None: - ... + def before_case(self, log: Logger, **kwargs: Any) -> None: ... - def after_case(self, log: Logger, **kwargs: Any) -> None: - ... + def after_case(self, log: Logger, **kwargs: Any) -> None: ... def start( self,