Skip to content

Commit

Permalink
Windows??
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Aug 23, 2024
1 parent bb83726 commit fdefb31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/uv/src/commands/python/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub(crate) async fn find(

println!(
"{}",
python.interpreter().sys_executable().simplified_display()
uv_fs::absolutize_path(python.interpreter().sys_executable())?.simplified_display()
);

Ok(ExitStatus::Success)
Expand Down
9 changes: 9 additions & 0 deletions crates/uv/tests/python_find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ fn python_find_venv() {
"###);

// We should find it first
// TODO(zanieb): On Windows, this has in a different display path for virtual environments which
// is super annoying and requires some changes to how we represent working directories in the
// test context to resolve.
#[cfg(not(windows))]
uv_snapshot!(context.filters(), context.python_find(), @r###"
success: true
exit_code: 0
Expand All @@ -273,6 +277,7 @@ fn python_find_venv() {
"###);

// Even if the `VIRTUAL_ENV` is not set (the test context includes this by default)
#[cfg(not(windows))]
uv_snapshot!(context.filters(), context.python_find().env_remove("VIRTUAL_ENV"), @r###"
success: true
exit_code: 0
Expand Down Expand Up @@ -321,6 +326,7 @@ fn python_find_venv() {
"###);

// We should find virtual environments from a child directory
#[cfg(not(windows))]
uv_snapshot!(context.filters(), context.python_find().current_dir(&child_dir).env_remove("VIRTUAL_ENV"), @r###"
success: true
exit_code: 0
Expand All @@ -339,6 +345,7 @@ fn python_find_venv() {
----- stderr -----
"###);

#[cfg(not(windows))]
uv_snapshot!(context.filters(), context.python_find().current_dir(&child_dir).env_remove("VIRTUAL_ENV"), @r###"
success: true
exit_code: 0
Expand All @@ -362,6 +369,7 @@ fn python_find_venv() {
"###);

// Unless, it is requested by path
#[cfg(not(windows))]
uv_snapshot!(context.filters(), context.python_find().arg("child/.venv"), @r###"
success: true
exit_code: 0
Expand All @@ -372,6 +380,7 @@ fn python_find_venv() {
"###);

// Or activated via `VIRTUAL_ENV`
#[cfg(not(windows))]
uv_snapshot!(context.filters(), context.python_find().env("VIRTUAL_ENV", child_dir.join(".venv").as_os_str()), @r###"
success: true
exit_code: 0
Expand Down

0 comments on commit fdefb31

Please sign in to comment.