tests/functional: simplify 'which' implementation
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 17 Dec 2024 15:59:26 +0000 (15:59 +0000)
committerThomas Huth <thuth@redhat.com>
Tue, 17 Dec 2024 18:39:53 +0000 (19:39 +0100)
The 'access' check implies the file exists.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20241217155953.3950506-6-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/functional/qemu_test/cmd.py

index 4106f1ee7cfe696cc8b5d6f0cabca5f7a40709cb..600e0509db38b6d35a2cdac79ef96dbbfc06949b 100644 (file)
@@ -25,7 +25,7 @@ def which(tool):
     paths=os.getenv('PATH')
     for p in paths.split(os.path.pathsep):
         p = os.path.join(p, tool)
-        if os.path.exists(p) and os.access(p, os.X_OK):
+        if os.access(p, os.X_OK):
             return p
     return None