From 6ac6bf373db1acee7f51a3d695e8b58e85f11801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sat, 19 Apr 2025 11:13:02 +0200 Subject: [PATCH] Force `sys.executable` in pytest fixture Fix the pytest fixture to respect `sys.executable` rather than finding an arbitrary Python version in `sys.base_prefix`. No clue why upstream changed the logic to do the latter, but it is clearly wrong on Gentoo. Bug: https://github.com/pdm-project/pdm/issues/3486 --- src/pdm/pytest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdm/pytest.py b/src/pdm/pytest.py index d23ad4b9..3f50c0f2 100644 --- a/src/pdm/pytest.py +++ b/src/pdm/pytest.py @@ -407,7 +407,7 @@ def project_no_init( tmp_path.joinpath("caches").mkdir(parents=True) p.global_config["cache_dir"] = tmp_path.joinpath("caches").as_posix() p.global_config["log_dir"] = tmp_path.joinpath("logs").as_posix() - python_path = find_python_in_path(sys.base_prefix) + python_path = Path(sys.executable) if python_path is None: raise ValueError("Unable to find a Python path") p._saved_python = python_path.as_posix()