Browse Source

iotests/297: update tool availability checks

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>
John Snow 3 years ago
parent
commit
7a90bcc269
1 changed files with 5 additions and 4 deletions
  1. 5 4
      tests/qemu-iotests/297

+ 5 - 4
tests/qemu-iotests/297

@@ -18,7 +18,6 @@
 
 
 import os
 import os
 import re
 import re
-import shutil
 import subprocess
 import subprocess
 import sys
 import sys
 from typing import List, Mapping, Optional
 from typing import List, Mapping, Optional
@@ -84,9 +83,11 @@ def run_linter(
 
 
 
 
 def main() -> None:
 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()
     files = get_test_files()