-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
lib_system_tests.rs
59 lines (46 loc) · 1.4 KB
/
lib_system_tests.rs
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
52
53
54
55
56
57
58
59
mod common;
use serial_test::serial;
use python_launcher::{ExactVersion, RequestedVersion};
use common::EnvState;
#[test]
#[serial]
fn all_executables() {
let env_state = EnvState::new();
let executables = python_launcher::all_executables();
assert_eq!(executables.len(), 3);
let python27_version = ExactVersion { major: 2, minor: 7 };
assert!(executables.contains_key(&python27_version));
assert_eq!(
executables.get(&python27_version),
Some(&env_state.python27)
);
let python36_version = ExactVersion { major: 3, minor: 6 };
assert!(executables.contains_key(&python27_version));
assert_eq!(
executables.get(&python36_version),
Some(&env_state.python36)
);
let python37_version = ExactVersion { major: 3, minor: 7 };
assert!(executables.contains_key(&python37_version));
assert_eq!(
executables.get(&python37_version),
Some(&env_state.python37)
);
}
#[test]
#[serial]
fn find_executable() {
let env_state = EnvState::new();
assert_eq!(
python_launcher::find_executable(RequestedVersion::Any),
Some(env_state.python37)
);
assert_eq!(
python_launcher::find_executable(RequestedVersion::MajorOnly(2)),
Some(env_state.python27)
);
assert_eq!(
python_launcher::find_executable(RequestedVersion::Exact(3, 6)),
Some(env_state.python36)
);
}