diff --git a/src-tauri/src/generations/mod.rs b/src-tauri/src/generations/mod.rs index 031b022..7de413c 100644 --- a/src-tauri/src/generations/mod.rs +++ b/src-tauri/src/generations/mod.rs @@ -159,15 +159,17 @@ impl GenerationStore { mod tests { use super::*; - fn tmp() -> std::path::PathBuf { - let dir = std::env::temp_dir().join(format!("dm-pal-test-{}", std::process::id())); + // ponytail: unique dir per test — both tests previously shared one + // pid-keyed dir and raced on the same SQLite file (flaky "disk I/O error"). + fn tmp(name: &str) -> std::path::PathBuf { + let dir = std::env::temp_dir().join(format!("dm-pal-test-{name}-{}", std::process::id())); let _ = std::fs::remove_dir_all(&dir); dir } #[test] fn round_trip() { - let dir = tmp(); + let dir = tmp("round-trip"); let store = GenerationStore::open(&dir).unwrap(); let id = store .add("npc", "Thorin Stonefist", r#"{"name":"Thorin"}"#, Some("Dwarf Fighter")) @@ -196,7 +198,7 @@ mod tests { #[test] fn clear_all() { - let dir = tmp(); + let dir = tmp("clear-all"); let store = GenerationStore::open(&dir).unwrap(); store.add("a", "x", "{}", None).unwrap(); store.add("b", "y", "{}", None).unwrap();