changeset 52573:918ef1fca39e

hghave: handle the case where the `black` executable is not on PATH For some reason, I can't reproduce this on either of my laptops, even when `black` isn't on `PATH`. But it was happening on the Windows CI system (where `black` isn't installed at all), and this was the exception raised.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 27 Dec 2024 19:58:57 -0500
parents 384d71e3dd65
children 11fa096c4467
files tests/hghave.py
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave.py	Tue Dec 17 22:54:36 2024 -0500
+++ b/tests/hghave.py	Fri Dec 27 19:58:57 2024 -0500
@@ -1142,12 +1142,16 @@
     if 'RUNTESTDIR' in env:
         cwd = os.path.realpath(f"{env['RUNTESTDIR']}/..")
 
-    p = subprocess.Popen(
-        ['black', '--check', '-'],
-        stdin=subprocess.PIPE,
-        cwd=cwd,
-        env=env,
-    )
+    try:
+        p = subprocess.Popen(
+            ['black', '--check', '-'],
+            stdin=subprocess.PIPE,
+            cwd=cwd,
+            env=env,
+        )
+    except FileNotFoundError:
+        return False
+
     p.communicate(b'# test\n')
     return p.returncode == 0