From dca45900dd0aac592cfec50196c83081cd80b764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Mon, 2 Nov 2026 08:03:00 -0800 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A7=AA=20test(discovery):=20accept=20?= =?UTF-8?q?free-threaded=20builds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_discovery.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_discovery.py b/tests/test_discovery.py index c418114..2a9cbfe 100644 --- a/tests/test_discovery.py +++ b/tests/test_discovery.py @@ -145,7 +145,7 @@ def test_discovery_fallback_reuses_preferred_paths( executable = preferred / ("Scripts/python.exe" if IS_WIN else "bin/python") paths = [str(executable)] result = get_interpreter( - ["missing-interpreter", str(sys.version_info.major)], + ["missing-interpreter", ">=3"], try_first_with=iter(paths) if use_iterator else paths, cache=session_cache, env={**os.environ, "PATH": str(tmp_path), "UV_PYTHON_INSTALL_DIR": str(tmp_path / "missing")}, @@ -157,7 +157,7 @@ def test_discovery_fallback_reuses_preferred_paths( def test_discovery_stops_reading_preferred_paths_after_match(session_cache: DiskCache) -> None: preferred_paths = iter([sys.executable, "unneeded"]) - result = get_interpreter(str(sys.version_info.major), try_first_with=preferred_paths, cache=session_cache) + result = get_interpreter(">=3", try_first_with=preferred_paths, cache=session_cache) assert result is not None assert next(preferred_paths) == "unneeded" From 93a42812a5392913e2a60d70a8a924f3586485c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Mon, 2 Nov 2026 08:14:35 -0800 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A7=AA=20test(discovery):=20avoid=20c?= =?UTF-8?q?opied=20interpreters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_discovery.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test_discovery.py b/tests/test_discovery.py index 2a9cbfe..73d6f84 100644 --- a/tests/test_discovery.py +++ b/tests/test_discovery.py @@ -1,5 +1,6 @@ from __future__ import annotations +import copy import logging import os import stat @@ -138,11 +139,14 @@ def test_discovery_invalid_specifier_raises(session_cache: DiskCache) -> None: [pytest.param(False, id="list"), pytest.param(True, id="iterator")], ) def test_discovery_fallback_reuses_preferred_paths( - tmp_path: Path, session_cache: DiskCache, *, use_iterator: bool + tmp_path: Path, session_cache: DiskCache, mocker: MockerFixture, *, use_iterator: bool ) -> None: - preferred = tmp_path / "preferred" - subprocess.check_call([sys.executable, "-m", "venv", "--without-pip", "--copies", str(preferred)]) - executable = preferred / ("Scripts/python.exe" if IS_WIN else "bin/python") + executable = tmp_path / "preferred" / ("Scripts/python.exe" if IS_WIN else "bin/python") + executable.parent.mkdir(parents=True) + executable.touch() + preferred_info = copy.deepcopy(PythonInfo.current_system(session_cache)) + preferred_info.executable = str(executable) + mocker.patch.object(PythonInfo, "from_exe", return_value=preferred_info) paths = [str(executable)] result = get_interpreter( ["missing-interpreter", ">=3"],