iotests/297: update tool availability checks
authorJohn Snow <jsnow@redhat.com>
Tue, 19 Oct 2021 14:49:12 +0000 (10:49 -0400)
committerJohn Snow <jsnow@redhat.com>
Mon, 1 Nov 2021 15:54:59 +0000 (11:54 -0400)
As mentioned in 'iotests/297: Don't rely on distro-specific linter
binaries', these checks are overly strict. Update them to be in-line
with how we actually invoke the linters themselves.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-id: 20211019144918.3159078-10-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
tests/qemu-iotests/297

index 76d6a23f5318290ac275f96431fb4d7ebc50378b..b2ad8d1cbe0a8cb4a6e47cf1229461400c0291f6 100755 (executable)
@@ -18,7 +18,6 @@
 
 import os
 import re
-import shutil
 import subprocess
 import sys
 from typing import List, Mapping, Optional
@@ -84,9 +83,11 @@ def run_linter(
 
 
 def main() -> None:
-    for linter in ('pylint-3', 'mypy'):
-        if shutil.which(linter) is None:
-            iotests.notrun(f'{linter} not found')
+    for linter in ('pylint', 'mypy'):
+        try:
+            run_linter(linter, ['--version'], suppress_output=True)
+        except subprocess.CalledProcessError:
+            iotests.notrun(f"'{linter}' not found")
 
     files = get_test_files()