From: Peter Michael Green Date: Sat, 25 Dec 2021 09:48:55 +0000 (+0000) Subject: fern - use tempfile instead of tempdir for tests. X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=6a6b0f8a8d77748f230c34a5a2734464b08c0cf3;p=debcargo-conf.git fern - use tempfile instead of tempdir for tests. --- diff --git a/src/fern/debian/changelog b/src/fern/debian/changelog index 7efe78ae2..32ca545b5 100644 --- a/src/fern/debian/changelog +++ b/src/fern/debian/changelog @@ -4,6 +4,8 @@ rust-fern (0.6.0-2) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium * Package fern 0.6.0 from crates.io using debcargo 2.5.0 * Remove optional (in the Cargo sense) dependency on reopen It is not packaged in Debian. + * Use tempfile instead of tempdir for tests, the latter is + not packaged in Debian. -- Peter Michael Green Sat, 25 Dec 2021 09:18:41 +0000 diff --git a/src/fern/debian/patches/no-syslog34.patch b/src/fern/debian/patches/no-syslog34.patch index ac838fe27..5cba2efef 100644 --- a/src/fern/debian/patches/no-syslog34.patch +++ b/src/fern/debian/patches/no-syslog34.patch @@ -4,8 +4,10 @@ Origin: other Forwarded: not-needed Last-Update: 2021-12-24 ---- rust-fern-0.6.0.orig/Cargo.toml -+++ rust-fern-0.6.0/Cargo.toml +Index: fern/Cargo.toml +=================================================================== +--- fern.orig/Cargo.toml ++++ fern/Cargo.toml @@ -43,11 +43,7 @@ required-features = ["colored"] [[example]] @@ -47,3 +49,39 @@ Last-Update: 2021-12-24 [badges.appveyor] repository = "daboross/fern" +Index: fern/examples/syslog3.rs +=================================================================== +--- fern.orig/examples/syslog3.rs ++++ fern/examples/syslog3.rs +@@ -1,4 +1,7 @@ +-#[cfg(not(windows))] ++//This example has been disabled to allow the rest of the testsuite to ++//run ++ ++/*#[cfg(not(windows))] + // This is necessary because `fern` depends on both version 3 and 4. + use syslog3 as syslog; + +@@ -15,11 +18,11 @@ fn setup_logging() -> Result<(), fern::I + .apply()?; + + Ok(()) +-} ++}*/ + + #[cfg(not(windows))] + fn main() { +- setup_logging().expect("failed to initialize logging."); ++ /*setup_logging().expect("failed to initialize logging."); + + // None of this will be shown in the syslog: + for i in 0..5 { +@@ -38,7 +41,7 @@ fn main() { + + info!(target: "explicit-syslog", "hello to the syslog! this is rust."); + +- warn!("AHHH something's on fire."); ++ warn!("AHHH something's on fire.");*/ + } + + #[cfg(windows)] diff --git a/src/fern/debian/patches/series b/src/fern/debian/patches/series index 849827e41..5dc6e7ffb 100644 --- a/src/fern/debian/patches/series +++ b/src/fern/debian/patches/series @@ -1,2 +1,3 @@ no-syslog34.patch no-reopen.patch +use-tempfile-instead-of-tempdir.patch diff --git a/src/fern/debian/patches/use-tempfile-instead-of-tempdir.patch b/src/fern/debian/patches/use-tempfile-instead-of-tempdir.patch new file mode 100644 index 000000000..60ceadb20 --- /dev/null +++ b/src/fern/debian/patches/use-tempfile-instead-of-tempdir.patch @@ -0,0 +1,72 @@ +Index: fern/Cargo.toml +=================================================================== +--- fern.orig/Cargo.toml ++++ fern/Cargo.toml +@@ -64,8 +64,8 @@ version = "0.4" + [dev-dependencies.clap] + version = "2.22" + +-[dev-dependencies.tempdir] +-version = "0.3" ++[dev-dependencies.tempfile] ++version = "3" + + [features] + date-based = ["chrono"] +Index: fern/tests/file_logging.rs +=================================================================== +--- fern.orig/tests/file_logging.rs ++++ fern/tests/file_logging.rs +@@ -10,7 +10,7 @@ use support::manual_log; + #[test] + fn test_basic_logging_file_logging() { + // Create a temporary directory to put a log file into for testing +- let temp_log_dir = tempdir::TempDir::new("fern").expect("Failed to set up temporary directory"); ++ let temp_log_dir = tempfile::TempDir::new().expect("Failed to set up temporary directory"); + let log_file = temp_log_dir.path().join("test.log"); + + { +@@ -70,7 +70,7 @@ fn test_basic_logging_file_logging() { + #[test] + fn test_custom_line_separators() { + // Create a temporary directory to put a log file into for testing +- let temp_log_dir = tempdir::TempDir::new("fern").expect("Failed to set up temporary directory"); ++ let temp_log_dir = tempfile::TempDir::new().expect("Failed to set up temporary directory"); + let log_file = temp_log_dir.path().join("test_custom_line_sep.log"); + + { +Index: fern/tests/meta_logging.rs +=================================================================== +--- fern.orig/tests/meta_logging.rs ++++ fern/tests/meta_logging.rs +@@ -36,7 +36,7 @@ impl<'a> fmt::Display for VerboseDisplay + #[test] + fn file_deadlock() { + // Create a temporary directory to put a log file into for testing +- let temp_log_dir = tempdir::TempDir::new("fern").expect("Failed to set up temporary directory"); ++ let temp_log_dir = tempfile::TempDir::new().expect("Failed to set up temporary directory"); + let log_file = temp_log_dir.path().join("test.log"); + + { +Index: fern/tests/reopen_logging.rs +=================================================================== +--- fern.orig/tests/reopen_logging.rs ++++ fern/tests/reopen_logging.rs +@@ -11,7 +11,7 @@ use support::manual_log; + #[test] + fn test_basic_logging_reopen_logging() { + // Create a temporary directory to put a log file into for testing +- let temp_log_dir = tempdir::TempDir::new("fern").expect("Failed to set up temporary directory"); ++ let temp_log_dir = tempfile::TempDir::new().expect("Failed to set up temporary directory"); + let log_file = temp_log_dir.path().join("test.log"); + + { +@@ -71,7 +71,7 @@ fn test_basic_logging_reopen_logging() { + #[test] + fn test_custom_line_separators() { + // Create a temporary directory to put a log file into for testing +- let temp_log_dir = tempdir::TempDir::new("fern").expect("Failed to set up temporary directory"); ++ let temp_log_dir = tempfile::TempDir::new().expect("Failed to set up temporary directory"); + let log_file = temp_log_dir.path().join("test_custom_line_sep.log"); + + {