Skip to content

Commit 24d1026

Browse files
Only use python.exe when searching in PATH
1 parent 47e41a8 commit 24d1026

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/unit/discovery/test_discovery.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def test_uv_python(monkeypatch, tmp_path_factory, mocker):
8989
monkeypatch.delenv("XDG_DATA_HOME", raising=False)
9090
monkeypatch.setenv("PATH", "")
9191
mocker.patch.object(PythonInfo, "satisfies", return_value=False)
92-
python_exe = "python.exe" if IS_WIN else "python"
9392

9493
# UV_PYTHON_INSTALL_DIR
9594
uv_python_install_dir = tmp_path_factory.mktemp("uv_python_install_dir")
@@ -101,15 +100,15 @@ def test_uv_python(monkeypatch, tmp_path_factory, mocker):
101100

102101
bin_path = uv_python_install_dir.joinpath("some-py-impl", "bin")
103102
bin_path.mkdir(parents=True)
104-
bin_path.joinpath(python_exe).touch()
103+
bin_path.joinpath("python").touch()
105104
get_interpreter("python", [])
106105
mock_from_exe.assert_called_once()
107106
assert mock_from_exe.call_args[0][0] == str(bin_path / "python")
108107

109108
# PATH takes precedence
110109
mock_from_exe.reset_mock()
111110
dir_in_path = tmp_path_factory.mktemp("path_bin_dir")
112-
dir_in_path.joinpath(python_exe).touch()
111+
dir_in_path.joinpath("python.exe" if IS_WIN else "python").touch()
113112
m.setenv("PATH", str(dir_in_path))
114113
get_interpreter("python", [])
115114
mock_from_exe.assert_called_once()
@@ -125,7 +124,7 @@ def test_uv_python(monkeypatch, tmp_path_factory, mocker):
125124

126125
bin_path = xdg_data_home.joinpath("uv", "python", "some-py-impl", "bin")
127126
bin_path.mkdir(parents=True)
128-
bin_path.joinpath(python_exe).touch()
127+
bin_path.joinpath().touch()
129128
get_interpreter("python", [])
130129
mock_from_exe.assert_called_once()
131130
assert mock_from_exe.call_args[0][0] == str(bin_path / "python")
@@ -140,7 +139,7 @@ def test_uv_python(monkeypatch, tmp_path_factory, mocker):
140139

141140
bin_path = user_data_path.joinpath("uv", "python", "some-py-impl", "bin")
142141
bin_path.mkdir(parents=True)
143-
bin_path.joinpath(python_exe).touch()
142+
bin_path.joinpath("python").touch()
144143
get_interpreter("python", [])
145144
mock_from_exe.assert_called_once()
146145
assert mock_from_exe.call_args[0][0] == str(bin_path / "python")

0 commit comments

Comments
 (0)