Skip to content

Commit

Permalink
Strip 'envs' prefix from conda env name (microsoft#23377)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne authored and anthonykim1 committed May 16, 2024
1 parent 0c16df9 commit 40ebe7a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion native_locator/src/conda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ fn get_distinct_conda_envs(
let mut named = false;
let mut name = "".to_string();
for location in &locations {
let location = Path::new(location);
let location = Path::new(location).join("envs");
match env.strip_prefix(location) {
Ok(prefix) => {
named = true;
Expand Down
4 changes: 2 additions & 2 deletions native_locator/tests/conda_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ fn finds_two_conda_envs_from_txt() {
let conda_2_exe = join_test_paths(&[conda_2.clone().as_str(), "python"]);

let expected_conda_env = json!({"executablePath":[conda_exe.clone()],"version":null});
let expected_conda_1 = json!({"name":"envs/one","pythonExecutablePath":[conda_1_exe.clone()],"category":"conda","version":"10.0.1","activatedRun":[conda_exe.clone(),"run","-n","envs/one","python"],"envPath":conda_1.clone(), "sysPrefixPath":conda_1.clone()});
let expected_conda_2 = json!({"name":"envs/two","pythonExecutablePath":[conda_2_exe.clone()],"category":"conda","version":null,"activatedRun":[conda_exe.clone(),"run","-n","envs/two","python"],"envPath":conda_2.clone(), "sysPrefixPath":conda_2.clone()});
let expected_conda_1 = json!({"name":"one","pythonExecutablePath":[conda_1_exe.clone()],"category":"conda","version":"10.0.1","activatedRun":[conda_exe.clone(),"run","-n","one","python"],"envPath":conda_1.clone(), "sysPrefixPath":conda_1.clone()});
let expected_conda_2 = json!({"name":"two","pythonExecutablePath":[conda_2_exe.clone()],"category":"conda","version":null,"activatedRun":[conda_exe.clone(),"run","-n","two","python"],"envPath":conda_2.clone(), "sysPrefixPath":conda_2.clone()});
assert_messages(
&[expected_conda_env, expected_conda_1, expected_conda_2],
&dispatcher,
Expand Down

0 comments on commit 40ebe7a

Please sign in to comment.