Merge pull request #193 from eqlabs/fix_use_tempfile

fix test using non-unique tempfile
This commit is contained in:
Joonas Koivunen 2020-06-18 01:16:08 +03:00 committed by GitHub
commit d1cd15b4ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

1
Cargo.lock generated
View File

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

View File

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

View File

@ -268,8 +268,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);