run-tests: fix _python for --local
authorPierre Augier <pierre.augier@univ-grenoble-alpes.fr>
Fri, 24 Jan 2025 23:06:59 +0100
changeset 52714 fa5a0c2b9f04
parent 52713 ba8aa20ff31f
child 52715 7aa46c5f56e7
run-tests: fix _python for --local `py -3.9 run-tests.py --local` was broken on default (`ModuleNotFoundError` for `mercurial`). see https://foss.heptapod.net/mercurial/mercurial-devel/-/merge_requests/1207#note_379493
tests/run-tests.py
--- a/tests/run-tests.py	Wed Jan 29 18:56:20 2025 +0100
+++ b/tests/run-tests.py	Fri Jan 24 23:06:59 2025 +0100
@@ -3291,10 +3291,9 @@
                     self._pythondir = get_site_packages_dir(python_exe)
                 except (FileNotFoundError, subprocess.CalledProcessError):
                     self._pythondir = self._bindir
-            elif self.options.local:
-                assert WINDOWS
-                python_exe = os.path.join(self._bindir, b"python.exe")
-                self._pythondir = get_site_packages_dir(python_exe)
+                if self.options.local:
+                    self._python = _bytes2sys(python_exe)
+
             # If it looks like our in-repo Rust binary, use the source root.
             # This is a bit hacky. But rhg is still not supported outside the
             # source directory. So until it is, do the simple thing.