From 88f46d12f1f3f7c2eac925ecb0b1c816ffddb943 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sat, 15 Feb 2020 09:12:21 -0500 Subject: [PATCH] tests: remove existing test directory I'm surprised this wasn't caught until now, but if a test directory already exists, then it was reused. This can result in hard to debug problems with tests when, e.g., file names are changed and a recursive search is executed. --- tests/util.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/util.rs b/tests/util.rs index a0150824..b529ca55 100644 --- a/tests/util.rs +++ b/tests/util.rs @@ -76,6 +76,9 @@ impl Dir { .join(TEST_DIR) .join(name) .join(&format!("{}", id)); + if dir.exists() { + nice_err(&dir, fs::remove_dir_all(&dir)); + } nice_err(&dir, repeat(|| fs::create_dir_all(&dir))); Dir { root: root,