Skip to content

Commit 9f7e2d4

Browse files
authored
Merge pull request #1979 from kinnison/kinnison/cleaner-tests
clitools: Clean up tests once run
2 parents 8c5cc14 + ee9a64b commit 9f7e2d4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/mock/clitools.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,15 @@ pub fn setup(s: Scenario, f: &dyn Fn(&mut Config)) {
8181
}
8282
let test_dir = exe_dir.parent().unwrap().join("tests");
8383
fs::create_dir_all(&test_dir).unwrap();
84+
let test_dir = tempfile::Builder::new()
85+
.prefix("running-test-")
86+
.tempdir_in(test_dir)
87+
.unwrap();
8488

85-
fn tempdir_in_with_prefix(path: &Path, prefix: &str) -> PathBuf {
89+
fn tempdir_in_with_prefix<P: AsRef<Path>>(path: P, prefix: &str) -> PathBuf {
8690
tempfile::Builder::new()
8791
.prefix(prefix)
88-
.tempdir_in(path)
92+
.tempdir_in(path.as_ref())
8993
.unwrap()
9094
.into_path()
9195
}

0 commit comments

Comments
 (0)