From b5d14a9d2d8632feac6d81121fd0a6d6d2214185 Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Mon, 5 Aug 2024 00:06:33 +0200 Subject: [PATCH] util/scanner: get rid of FutureWarning message Get rid of the warning: teuthology/util/test/test_scanner.py::TestValgrindScanner::test_scan_all_files /Users/kyr/kshtsk/teuthology/teuthology/util/scanner.py:133: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. if not xml_tree: Signed-off-by: Kyr Shatskyy --- teuthology/util/scanner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/teuthology/util/scanner.py b/teuthology/util/scanner.py index b67d88c925..421d5a028b 100644 --- a/teuthology/util/scanner.py +++ b/teuthology/util/scanner.py @@ -130,7 +130,7 @@ class ValgrindScanner(Scanner): def _parse(self, file_content: str) -> Tuple[Optional[str], Optional[dict]]: xml_tree = etree.fromstring(file_content) - if not xml_tree: + if xml_tree is None: return None, None error_tree = xml_tree.find('error') -- 2.39.5