]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
util/scanner: get rid of FutureWarning message
authorKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Sun, 4 Aug 2024 22:06:33 +0000 (00:06 +0200)
committerKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Sun, 4 Aug 2024 23:05:11 +0000 (01:05 +0200)
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 <kyrylo.shatskyy@clyso.com>
teuthology/util/scanner.py

index b67d88c92594ee3b23430ddbe9e496be2448861f..421d5a028b0719899d5415ed3a18e69a65edda41 100644 (file)
@@ -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')