From 3b897529dd89a1a119bb3719ce7a4a8a8ea61e29 Mon Sep 17 00:00:00 2001 From: David Liu Date: Wed, 20 Sep 2023 19:13:22 -0400 Subject: [PATCH] Java tester: Fix handling of test failures/errors (#451) --- server/autotest_server/testers/java/java_tester.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/autotest_server/testers/java/java_tester.py b/server/autotest_server/testers/java/java_tester.py index 9222dff8..051c2f97 100644 --- a/server/autotest_server/testers/java/java_tester.py +++ b/server/autotest_server/testers/java/java_tester.py @@ -70,15 +70,15 @@ def _parse_failure_error(self, failure, error): an error and failure are present, the message includes information for both. """ result = {} - if failure and error: + if failure is not None and error is not None: failure_message = self._parse_failure_error(failure, None)["message"] error_message = self._parse_failure_error(None, error)["message"] result["status"] = "error" result["message"] = "\n\n".join([error_message, failure_message]) - elif failure: + elif failure is not None: result["status"] = "failure" result["message"] = f'{failure.attrib.get("type", "")}: {failure.attrib.get("message", "")}' - elif error: + elif error is not None: result["status"] = "error" result["message"] = f'{error.attrib.get("type", "")}: {error.attrib.get("message", "")}' return result