forked from microsoft/python-environment-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecutable_test.rs
More file actions
51 lines (41 loc) · 1.49 KB
/
executable_test.rs
File metadata and controls
51 lines (41 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#![cfg(unix)]
mod common;
use pet_python_utils::executable;
use std::path::PathBuf;
use common::resolve_test_path;
#[cfg(unix)]
#[test]
fn find_executables() {
// .venv
let path: PathBuf = resolve_test_path(&["unix", "executables", ".venv"]);
let mut executables = executable::find_executables(path.clone());
executables.sort();
assert_eq!(
executables,
vec![
resolve_test_path(&["unix", "executables", ".venv", "bin", "python"]),
resolve_test_path(&["unix", "executables", ".venv", "bin", "python3"]),
]
);
// Python3.9.9
let path: PathBuf = resolve_test_path(&["unix", "executables", "python3.9.9"]);
let mut executables = executable::find_executables(path.clone());
executables.sort();
assert_eq!(
executables,
vec![
resolve_test_path(&["unix", "executables", "python3.9.9", "bin", "python3"]),
resolve_test_path(&["unix", "executables", "python3.9.9", "bin", "python3.9.9"]),
]
);
// Conda without Python.
let path: PathBuf = resolve_test_path(&["unix", "executables", "conda_without_python"]);
let executables = executable::find_executables(path.clone());
assert_eq!(executables.len(), 0);
// Bogus dir
let path: PathBuf = resolve_test_path(&["unix_bogus_dir"]);
let executables = executable::find_executables(path.clone());
assert_eq!(executables.len(), 0);
}