diff --git a/news/7924.bugfix b/news/7924.bugfix
new file mode 100644
index 00000000000..56411478deb
--- /dev/null
+++ b/news/7924.bugfix
@@ -0,0 +1 @@
+Catch ``subprocess.CalledProcessError`` when checking for the presence of executable within ``need_executable`` using pytest.
diff --git a/tests/lib/__init__.py b/tests/lib/__init__.py
index 65a2399261e..1c1bac274bf 100644
--- a/tests/lib/__init__.py
+++ b/tests/lib/__init__.py
@@ -1079,7 +1079,7 @@ def need_executable(name, check_cmd):
     def wrapper(fn):
         try:
             subprocess.check_output(check_cmd)
-        except OSError:
+        except (OSError, subprocess.CalledProcessError):
             return pytest.mark.skip(
                 reason='{name} is not available'.format(name=name))(fn)
         return fn