Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adriantombu committed Jul 23, 2024
1 parent 926a0dc commit 33c372b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/common/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2448,7 +2448,9 @@ mod test {
if !IS_SUPPORTED_SYSTEM {
return;
}
let mut s = System::new();
let mut s = System::new_with_specifics(
RefreshKind::new().with_processes(ProcessRefreshKind::everything()),
);
let total = s.processes().len() as isize;
s.refresh_processes();
let new_total = s.processes().len() as isize;
Expand Down
2 changes: 1 addition & 1 deletion tests/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn test_cpu() {
s.refresh_cpu_all();
assert!(!s.cpus().is_empty());

s.refresh_specifics(
let s = sysinfo::System::new_with_specifics(
sysinfo::RefreshKind::new().with_cpu(sysinfo::CpuRefreshKind::everything()),
);
assert!(!s.cpus().is_empty());
Expand Down
4 changes: 3 additions & 1 deletion tests/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,9 @@ fn test_process_cpu_usage() {
return;
}

let mut sys = System::new();
let mut sys = sysinfo::System::new_with_specifics(
sysinfo::RefreshKind::new().with_cpu(sysinfo::CpuRefreshKind::everything()),
);
std::thread::sleep(sysinfo::MINIMUM_CPU_UPDATE_INTERVAL);
sys.refresh_all();

Expand Down
2 changes: 1 addition & 1 deletion tests/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fn test_consecutive_cpu_usage_update() {
return;
}

let mut sys = System::new();
let mut sys = System::new_with_specifics(sysinfo::RefreshKind::everything());
assert!(!sys.cpus().is_empty());
sys.refresh_processes_specifics(ProcessRefreshKind::new().with_cpu());

Expand Down

0 comments on commit 33c372b

Please sign in to comment.