Skip to content

Commit 03fbba2

Browse files
committed
Fixes
1 parent 409965e commit 03fbba2

File tree

5 files changed

+36
-14
lines changed

5 files changed

+36
-14
lines changed

crates/pet-conda/tests/conda_rc_test.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
// Licensed under the MIT License.
33

44
mod common;
5-
use common::resolve_test_path;
6-
use pet_conda::conda_rc::Condarc;
7-
use std::path::PathBuf;
85

96
#[cfg(unix)]
107
#[test]
118
fn no_conda_rc() {
129
use common::create_env_variables;
10+
use common::resolve_test_path;
11+
use pet_conda::conda_rc::Condarc;
1312

1413
let root = resolve_test_path(&["unix", "root_empty"]);
1514
let home = resolve_test_path(&["unix", "user_home_with_environments_txt"]);
@@ -24,6 +23,9 @@ fn no_conda_rc() {
2423
#[test]
2524
fn finds_conda_rc() {
2625
use common::create_env_variables;
26+
use common::resolve_test_path;
27+
use pet_conda::conda_rc::Condarc;
28+
use std::path::PathBuf;
2729

2830
let root = resolve_test_path(&["unix", "conda_rc", "root"]);
2931
let home = resolve_test_path(&["unix", "conda_rc", "user_home"]);
@@ -44,6 +46,9 @@ fn finds_conda_rc() {
4446
#[test]
4547
fn finds_conda_rc_from_conda_root_env_variable() {
4648
use common::create_env_variables;
49+
use common::resolve_test_path;
50+
use pet_conda::conda_rc::Condarc;
51+
use std::path::PathBuf;
4752

4853
let root = resolve_test_path(&["unix", "conda_rc_conda_root_var", "root"]);
4954
let home = resolve_test_path(&["unix", "conda_rc_conda_root_var", "user_home"]);
@@ -75,6 +80,9 @@ fn finds_conda_rc_from_conda_root_env_variable() {
7580
#[test]
7681
fn finds_conda_rc_from_root() {
7782
use common::create_env_variables;
83+
use common::resolve_test_path;
84+
use pet_conda::conda_rc::Condarc;
85+
use std::path::PathBuf;
7886

7987
let root = resolve_test_path(&["unix", "conda_rc_root", "root"]);
8088
let home = resolve_test_path(&["unix", "conda_rc_root", "user_home"]);

crates/pet-conda/tests/environment_locations_test.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
// Licensed under the MIT License.
33

44
mod common;
5-
use common::{create_env_variables, resolve_test_path};
6-
use pet_conda::environment_locations::{
7-
get_conda_envs_from_environment_txt, get_environments, get_known_conda_locations,
8-
};
9-
use std::path::PathBuf;
105

116
#[cfg(unix)]
127
#[test]
138
fn read_environment_txt() {
9+
use common::{create_env_variables, resolve_test_path};
10+
use pet_conda::environment_locations::get_conda_envs_from_environment_txt;
11+
use std::path::PathBuf;
12+
1413
let root = resolve_test_path(&["unix", "root_empty"]).into();
1514
let home = resolve_test_path(&["unix", "user_home_with_environments_txt"]).into();
1615
let env = create_env_variables(home, root);
@@ -53,6 +52,9 @@ fn read_environment_txt() {
5352
#[cfg(unix)]
5453
#[test]
5554
fn non_existent_envrionments_txt() {
55+
use common::{create_env_variables, resolve_test_path};
56+
use pet_conda::environment_locations::get_conda_envs_from_environment_txt;
57+
5658
let root = resolve_test_path(&["unix", "root_empty"]).into();
5759
let home = resolve_test_path(&["unix", "bogus directory"]).into();
5860
let env = create_env_variables(home, root);
@@ -65,6 +67,10 @@ fn non_existent_envrionments_txt() {
6567
#[cfg(unix)]
6668
#[test]
6769
fn known_install_locations() {
70+
use common::{create_env_variables, resolve_test_path};
71+
use pet_conda::environment_locations::get_known_conda_locations;
72+
use std::path::PathBuf;
73+
6874
let root = resolve_test_path(&["unix", "root_empty"]).into();
6975
let home = resolve_test_path(&["unix", "user_home"]).into();
7076
let env = create_env_variables(home, root);
@@ -102,6 +108,9 @@ fn known_install_locations() {
102108
#[cfg(unix)]
103109
#[test]
104110
fn list_conda_envs_in_install_location() {
111+
use common::resolve_test_path;
112+
use pet_conda::environment_locations::get_environments;
113+
105114
let path = resolve_test_path(&["unix", "anaconda3-2023.03"]);
106115

107116
let mut locations = get_environments(&path);

crates/pet-conda/tests/manager_test.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
// Licensed under the MIT License.
33

44
mod common;
5-
use common::resolve_test_path;
6-
use pet_conda::manager::CondaManager;
75

86
#[cfg(unix)]
97
#[test]
108
fn finds_manager_from_root_env() {
9+
use common::resolve_test_path;
10+
use pet_conda::manager::CondaManager;
11+
1112
let path = resolve_test_path(&["unix", "anaconda3-2023.03"]);
1213

1314
let manager = CondaManager::from(&path).unwrap();
@@ -19,6 +20,9 @@ fn finds_manager_from_root_env() {
1920
#[cfg(unix)]
2021
#[test]
2122
fn finds_manager_from_root_within_an_env() {
23+
use common::resolve_test_path;
24+
use pet_conda::manager::CondaManager;
25+
2226
let conda_dir = resolve_test_path(&["unix", "anaconda3-2023.03"]);
2327
let path = resolve_test_path(&["unix", "anaconda3-2023.03", "envs", "env_python_3"]);
2428

@@ -39,6 +43,9 @@ fn finds_manager_from_root_within_an_env() {
3943
#[cfg(unix)]
4044
#[test]
4145
fn does_not_find_conda_env_for_bogus_dirs() {
46+
use common::resolve_test_path;
47+
use pet_conda::manager::CondaManager;
48+
4249
let path = resolve_test_path(&["unix", "bogus_directory"]);
4350

4451
assert_eq!(CondaManager::from(&path).is_none(), true);

crates/pet-utils/src/env.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
use std::path::PathBuf;
5-
64
use crate::path::normalize;
5+
use std::path::PathBuf;
76

87
#[derive(Debug)]
98
pub struct PythonEnv {

crates/pet-windows-store/src/environments.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,13 @@ struct StorePythonInfo {
187187
#[cfg(windows)]
188188
fn get_package_display_name_and_location(name: &String, hkcu: &RegKey) -> Option<StorePythonInfo> {
189189
use log::trace;
190-
use pet_utils::path::normalize;
191190

192191
if let Some(name) = get_package_full_name_from_registry(name, hkcu) {
193192
let key = format!("Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\CurrentVersion\\AppModel\\Repository\\Packages\\{}", name);
194193
trace!("Opening registry key {:?}", key);
195194
let package_key = hkcu.open_subkey(key).ok()?;
196195
let display_name = package_key.get_value("DisplayName").ok()?;
197-
let env_path = normalize(package_key.get_value("PackageRootFolder").ok()?);
196+
let env_path = package_key.get_value("PackageRootFolder").ok()?;
198197

199198
return Some(StorePythonInfo {
200199
display_name,

0 commit comments

Comments
 (0)