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.
This commit is contained in:
Andrew Gallant 2020-02-15 09:12:21 -05:00
parent a18cf6ec39
commit 88f46d12f1

View File

@ -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,