From ecfed5d7e344c617f582d1d91c7395a210a70192 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Nov 2026 11:14:56 +0000 Subject: files: a test's scratch directory goes when the test ends `scratch_dir` gives a guard (`Scratch`) that removes the directory with all it holds when dropped, the test passing or failing. Each test keeps it for as long as it uses the directory; the dashboard's browser check writes its page into one. --- src/api/dashboard/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/api') diff --git a/src/api/dashboard/mod.rs b/src/api/dashboard/mod.rs index 15b8cf9..c0de169 100644 --- a/src/api/dashboard/mod.rs +++ b/src/api/dashboard/mod.rs @@ -913,8 +913,8 @@ mod tests { #[test] #[ignore] fn dashboard_in_a_browser() { - let file = - std::env::temp_dir().join(format!("continuum-dashboard-{}.html", std::process::id())); + let dir = crate::files::scratch_dir("dashboard"); + let file = dir.join("page.html"); std::fs::write(&file, &page().1).expect("page written"); let check = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/api/dashboard/check.js"); @@ -928,7 +928,6 @@ mod tests { PATH, with Playwright's library and its Chromium (check.nix)" ) }); - let _ = std::fs::remove_file(&file); assert!(status.success(), "the browser checks failed"); } -- cgit v1.3.1