diff tests/run-tests.py @ 52588:9b5e058a7fb9

run-tests: use shutil.which now that we can We needed to drop compatibility with Python Version < 3.8. This is now done.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 06 Jan 2025 03:36:01 +0100
parents 732c7ad5d684
children 484a4d5d360e
line wrap: on
line diff
--- a/tests/run-tests.py	Mon Dec 30 21:48:33 2024 +0100
+++ b/tests/run-tests.py	Mon Jan 06 03:36:01 2025 +0100
@@ -399,13 +399,6 @@
     return os.path.realpath(os.path.expanduser(path))
 
 
-def which(exe):
-    # shutil.which only accept bytes from 3.8
-    cmd = _bytes2sys(exe)
-    real_exec = shutil.which(cmd)
-    return _sys2bytes(real_exec)
-
-
 def parselistfiles(files, listtype, warn=True):
     entries = dict()
     for filename in files:
@@ -3815,8 +3808,7 @@
     def _use_correct_mercurial(self):
         target_exec = os.path.join(self._custom_bin_dir, b'hg')
         if self._hgcommand != b'hg':
-            # shutil.which only accept bytes from 3.8
-            real_exec = which(self._hgcommand)
+            real_exec = shutil.which(self._hgcommand)
             if real_exec is None:
                 raise ValueError('could not find exec path for "%s"', real_exec)
             if real_exec == target_exec: