From 02edf11c8cff637d1bc0181d0ab4666717771451 Mon Sep 17 00:00:00 2001 From: Lili Deng Date: Fri, 15 Nov 2024 16:21:19 +0800 Subject: [PATCH] avoid fetching information unnecessarily when rerun env --- lisa/testsuite.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lisa/testsuite.py b/lisa/testsuite.py index 1e6dbedabd..f638ed7dd1 100644 --- a/lisa/testsuite.py +++ b/lisa/testsuite.py @@ -290,7 +290,18 @@ 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() + # avoid fetching information unnecessarily when rerun env + force_run = True + if ( + result_message.status + in [TestResult.status.RUNNING, TestResult.status.SKIPPED] + 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