Skip to content

Commit 8480215

Browse files
committed
Minor refactor in test class host
This reduces log noise for tests that reset the device under test
1 parent 1e08b56 commit 8480215

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

tests/test_class_host/device.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,7 @@ impl DeviceHandles {
6565

6666
/// Cleanup the device following a test
6767
pub fn post_test(&mut self) -> rusb::Result<()> {
68-
let res = self.release_interface(TEST_INTERFACE);
69-
if let Err(err) = res {
70-
println!("Failed to release interface: {}", err);
71-
return res;
72-
}
73-
74-
Ok(())
68+
self.release_interface(TEST_INTERFACE)
7569
}
7670
}
7771

tests/test_class_host/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ fn run_tests(tests: &[(&str, TestFn)]) {
4343
res
4444
};
4545

46-
ctx.cleanup_after_test().expect("post test cleanup failed");
46+
if let Err(err) = ctx.cleanup_after_test() {
47+
println!("Failed to release interface: {}", err);
48+
panic!("post test cleanup failed");
49+
}
4750

4851
if let Err(err) = res {
4952
let err = if let Some(err) = err.downcast_ref::<&'static str>() {

0 commit comments

Comments
 (0)