From e7097fde2c8149da500c67b4a9cfd5fe751e6cf4 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 31 Oct 2026 15:04:32 +0100 Subject: [PATCH] self-session-live tests: spools in tempfile directories (clippy disallows temp_dir) Co-Authored-By: Claude Sonnet 5.5 --- crates/mind-body/src/self_run/tests.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/mind-body/src/self_run/tests.rs b/crates/mind-body/src/self_run/tests.rs index e6c9904..df9b8b3 100644 --- a/crates/mind-body/src/self_run/tests.rs +++ b/crates/mind-body/src/self_run/tests.rs @@ -197,11 +197,13 @@ impl Fake { } } -/// A spool of its own under the system temporary directory, so that tests running side by side share nothing. +/// A spool of its own, so that tests running side by side share nothing. Its directory outlives +/// the test: a run's spool is read back after `carry` returns. fn test_hooks() -> Hooks { - static NEXT: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); - let n = NEXT.fetch_add(1, std::sync::atomic::Ordering::Relaxed); - Hooks { spool: std::env::temp_dir().join(format!("mind-self-run-spool-{}-{n}", std::process::id())), injector: PathBuf::from("/opt/mind-self-run") } + let dir = tempfile::tempdir().unwrap(); + let spool = dir.path().join("inbox"); + std::mem::forget(dir); + Hooks { spool, injector: PathBuf::from("/opt/mind-self-run") } } impl Spawner for Fake {