Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions e2e-win/uv.Tests.ps1
Original file line number Diff line number Diff line change
@@ -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"
}
}
6 changes: 5 additions & 1 deletion src/uv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ pub async fn uv_venv(config: &Arc<Config>, ts: &Toolset) -> &'static Option<Venv

async fn get_or_create_venv(ts: &Toolset, venv_path: PathBuf, uv_path: PathBuf) -> Result<Venv> {
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
Expand Down
Loading