fix test using non-unique tempfile

This commit is contained in:
Joonas Koivunen 2020-06-18 00:55:11 +03:00
parent f5bad262ec
commit 3ba5ddf1a3
3 changed files with 4 additions and 2 deletions

1
Cargo.lock generated
View File

@ -1432,6 +1432,7 @@ dependencies = [
"serde_json",
"structopt",
"tar",
"tempfile",
"thiserror",
"tokio 0.2.16",
"url",

View File

@ -37,3 +37,4 @@ bytes = "0.5.4"
[dev-dependencies]
hex = "0.4.2"
hex-literal = "0.2.1"
tempfile = "3.1.0"

View File

@ -269,8 +269,8 @@ mod tests {
let size = header.size()?;
// writing to file is the only supported way to get the contents
let mut temp_file = std::env::temp_dir();
temp_file.push("temporary_file_for_testing.txt");
let tempdir = tempfile::tempdir()?;
let temp_file = tempdir.path().join("temporary_file_for_testing.txt");
entry.unpack(&temp_file)?;
let bytes = std::fs::read(&temp_file);