From 04d58f307a42d00e1dea81e47a772819f5fa0cdd Mon Sep 17 00:00:00 2001 From: Ryangwaite Date: Fri, 24 May 2024 11:15:36 +1000 Subject: [PATCH] Include advanced-reboot ptf exception in pytest assertion (#12941) What is the motivation for this PR? Surface more information in our test reporting infrastructure to aid in debugging How did you do it? Added more information to a pytest assertion. How did you verify/test it? Artificially added an exception to the try-except block and saw that it was printed out in the pytest assertions. --- tests/common/fixtures/advanced_reboot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/common/fixtures/advanced_reboot.py b/tests/common/fixtures/advanced_reboot.py index 60de0a91274..5b06de320d8 100644 --- a/tests/common/fixtures/advanced_reboot.py +++ b/tests/common/fixtures/advanced_reboot.py @@ -579,8 +579,9 @@ def runRebootTest(self): self.postboot_setup() except Exception: traceback_msg = traceback.format_exc() - logger.error("Exception caught while running advanced-reboot test on ptf: \n{}".format(traceback_msg)) - test_results[test_case_name].append("Exception caught while running advanced-reboot test on ptf") + err_msg = "Exception caught while running advanced-reboot test on ptf: \n{}".format(traceback_msg) + logger.error(err_msg) + test_results[test_case_name].append(err_msg) finally: # capture the test logs, and print all of them in case of failure, or a summary in case of success log_dir = self.__fetchTestLogs(rebootOper)