diff --git a/e2e-win/uv.Tests.ps1 b/e2e-win/uv.Tests.ps1 new file mode 100644 index 0000000000..46d0bc4fb8 --- /dev/null +++ b/e2e-win/uv.Tests.ps1 @@ -0,0 +1,40 @@ + +Describe 'uv' { + BeforeEach { + $originalPath = Get-Location + Set-Location TestDrive: + } + + AfterEach { + mise trust --untrust --yes .mise.toml + Set-Location $originalPath | Out-Null + } + + It 'executes from the venv Scripts directory' { + @( + '[env._.python]', + 'venv = {path = "my_venv", create=true}', + '[tools]', + 'python = "3.12.3"', + 'uv = "0.8.21"', + '[settings]', + 'python.uv_venv_auto = true' + ) | Set-Content .mise.toml + mise trust --yes .mise.toml + + # Define the character set + $chars = (48..57) + (65..90) + (97..122) # 0-9, A-Z, a-z + + # Generate a random string of a specific length (e.g., 10 characters) + $randomString = -join ($chars | Get-Random -Count 10 | ForEach-Object {[char]$_}) + + mise x -- uv init . + mise x -- uv add --active --link-mode=copy cowsay + + mise i + + mise x -- cowsay -t $randomString | Out-String | Should -BeLikeExactly "*$randomString*" + + mise x -- python -c "import sys; print(sys.executable)" | Should -BeLikeExactly "*my_venv\Scripts\python.exe" + } +} diff --git a/src/uv.rs b/src/uv.rs index 4c5b45ae11..4faf464063 100644 --- a/src/uv.rs +++ b/src/uv.rs @@ -42,9 +42,13 @@ pub async fn uv_venv(config: &Arc, ts: &Toolset) -> &'static Option Result { Settings::get().ensure_experimental("uv venv auto")?; + #[cfg(windows)] + let venv_bin_dir = "Scripts"; + #[cfg(not(windows))] + let venv_bin_dir = "bin"; let mut venv = Venv { env: Default::default(), - venv_path: venv_path.join("bin"), + venv_path: venv_path.join(venv_bin_dir), }; if let Some(python_tv) = ts .versions