Skip to content

Commit

Permalink
fix: clean-up paths created during tests (#2126)
Browse files Browse the repository at this point in the history
# Description

This PR make sure we clean up after ourselves when running tests by
removing some folder artifacts we create in tests.
  • Loading branch information
roeap authored Jan 26, 2024
1 parent 83f77b1 commit 2a28475
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/deltalake-core/src/table/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,17 @@ mod tests {
// parse an existing relative directory
let uri = ensure_table_uri(".");
assert!(uri.is_ok());
let uri = ensure_table_uri("./nonexistent");
assert!(uri.is_ok());
let uri = ensure_table_uri("s3://container/path");
assert!(uri.is_ok());
#[cfg(not(windows))]
{
let uri = ensure_table_uri("file:///tmp/nonexistent/some/path");
assert!(uri.is_ok());
}
let uri = ensure_table_uri("./nonexistent");
assert!(uri.is_ok());
let file_path = std::path::Path::new("./nonexistent");
std::fs::remove_dir(file_path).unwrap();

// These cases should all roundtrip to themselves
cfg_if::cfg_if! {
Expand Down Expand Up @@ -535,7 +537,7 @@ mod tests {
assert!(!relative_path.exists());
ensure_table_uri(relative_path.as_os_str().to_str().unwrap()).unwrap();
assert!(relative_path.exists());
std::fs::remove_dir_all(relative_path).unwrap();
std::fs::remove_dir_all(std::path::Path::new("_tmp")).unwrap();
}

#[test]
Expand Down

0 comments on commit 2a28475

Please sign in to comment.