diff --git a/tests/by-util/test_lslocks.rs b/tests/by-util/test_lslocks.rs
index b56dcf8..3cd9dcd 100644
--- a/tests/by-util/test_lslocks.rs
+++ b/tests/by-util/test_lslocks.rs
@@ -3,6 +3,7 @@
 // For the full copyright and license information, please view the LICENSE
 // file that was distributed with this source code.
 
+#[cfg(target_os = "linux")]
 use crate::common::util::TestScenario;
 
 #[test]
diff --git a/tests/by-util/test_mcookie.rs b/tests/by-util/test_mcookie.rs
index 9167b80..3fd2096 100644
--- a/tests/by-util/test_mcookie.rs
+++ b/tests/by-util/test_mcookie.rs
@@ -5,7 +5,7 @@
 
 use std::io::Write;
 
-use tempfile::{NamedTempFile, TempDir};
+use tempfile::NamedTempFile;
 
 use crate::common::util::TestScenario;