From 3bb0f07a4bda7e02310f83fdd16532fa6d3cab0e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 21 Oct 2026 15:26:14 -0700 Subject: [PATCH] Tests: the data set export test fails when its folder cannot be emptied (#3389) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit variables_panel_data_sets_ask_off_the_ui_thread empties its folder before Export Data Sets… writes out.csv, then checks that the file is exactly the header and the row for data set B. It ignored the result of remove_dir_all, and create_dir_all succeeds on a folder that is still there. When the folder could not be emptied, an out.csv left by an earlier run passed the check even when the export wrote nothing. The test now fails when emptying the folder fails with an error other than NotFound. --- crates/ui-egui/src/tests_picks.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/tests_picks.rs b/crates/ui-egui/src/tests_picks.rs index 58ba8d2e0..3aa8f21b3 100644 --- a/crates/ui-egui/src/tests_picks.rs +++ b/crates/ui-egui/src/tests_picks.rs @@ -229,7 +229,9 @@ fn variables_panel_data_sets_ask_off_the_ui_thread() { let (mut app, shown, _) = app(); app.run("file.new", json!({"width": 100, "height": 80})).unwrap(); let dir = vectorcraft_testkit::temp_dir("picks-data-sets"); - let _ = std::fs::remove_dir_all(&dir); + if let Err(e) = std::fs::remove_dir_all(&dir) { + assert_eq!(e.kind(), std::io::ErrorKind::NotFound, "cannot empty {}: {e}", dir.display()); + } std::fs::create_dir_all(&dir).unwrap(); let (csv, out) = (dir.join("sets.csv"), dir.join("out.csv")); std::fs::write(&csv, "name,Name\nB,y\n").unwrap();