Skip to content

fix: Migrate from tempdir to tempfile crate #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ serde_bytes = "0.11.8"
serde_derive = "^1.0"
serde_json = "^1.0"
serde_repr = "0.1.16"
tempdir = "0.3"
tempfile = "3.8"
tokio = { version = "1", features = ["macros"] }
typed-builder = "^0.18"
url = "2"
Expand Down
2 changes: 1 addition & 1 deletion crates/iceberg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ uuid = { workspace = true }

[dev-dependencies]
pretty_assertions = { workspace = true }
tempdir = { workspace = true }
tempfile = { workspace = true }
tokio = { workspace = true }
10 changes: 5 additions & 5 deletions crates/iceberg/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ mod tests {
use futures::io::AllowStdIo;
use futures::{AsyncReadExt, AsyncWriteExt};

use tempdir::TempDir;
use tempfile::TempDir;

use super::{FileIO, FileIOBuilder};

Expand All @@ -415,7 +415,7 @@ mod tests {

#[tokio::test]
async fn test_local_input_file() {
let tmp_dir = TempDir::new("test").unwrap();
let tmp_dir = TempDir::new().unwrap();

let file_name = "a.txt";
let content = "Iceberg loves rust.";
Expand All @@ -436,7 +436,7 @@ mod tests {

#[tokio::test]
async fn test_delete_local_file() {
let tmp_dir = TempDir::new("test").unwrap();
let tmp_dir = TempDir::new().unwrap();

let file_name = "a.txt";
let content = "Iceberg loves rust.";
Expand All @@ -452,7 +452,7 @@ mod tests {

#[tokio::test]
async fn test_delete_non_exist_file() {
let tmp_dir = TempDir::new("test").unwrap();
let tmp_dir = TempDir::new().unwrap();

let file_name = "a.txt";
let full_path = format!("{}/{}", tmp_dir.path().to_str().unwrap(), file_name);
Expand All @@ -464,7 +464,7 @@ mod tests {

#[tokio::test]
async fn test_local_output_file() {
let tmp_dir = TempDir::new("test").unwrap();
let tmp_dir = TempDir::new().unwrap();

let file_name = "a.txt";
let content = "Iceberg loves rust.";
Expand Down
6 changes: 3 additions & 3 deletions crates/iceberg/src/spec/manifest_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ pub(super) mod _serde {
mod test {
use std::{fs, sync::Arc};

use tempdir::TempDir;
use tempfile::TempDir;

use crate::{
io::FileIOBuilder,
Expand Down Expand Up @@ -1091,7 +1091,7 @@ mod test {
}]
};

let temp_dir = TempDir::new("manifest_list_v1").unwrap();
let temp_dir = TempDir::new().unwrap();
let path = temp_dir.path().join("manifest_list_v1.avro");
let io = FileIOBuilder::new_fs_io().build().unwrap();
let output_file = io.new_output(path.to_str().unwrap()).unwrap();
Expand Down Expand Up @@ -1140,7 +1140,7 @@ mod test {
}]
};

let temp_dir = TempDir::new("manifest_list_v2").unwrap();
let temp_dir = TempDir::new().unwrap();
let path = temp_dir.path().join("manifest_list_v2.avro");
let io = FileIOBuilder::new_fs_io().build().unwrap();
let output_file = io.new_output(path.to_str().unwrap()).unwrap();
Expand Down