Skip to content

Apache DataFusion SQL Query Engine

Fix test that's broken on Windows due to naive path handling (#20692)

Alexander Raffertydd988f6efc22
diff --git a/datafusion/core/src/datasource/mod.rs b/datafusion/core/src/datasource/mod.rs
index 32b3b0799d..c0cb9b5fa0 100644
--- a/datafusion/core/src/datasource/mod.rs
+++ b/datafusion/core/src/datasource/mod.rs
@@ -76,6 +76,7 @@ mod tests {
use datafusion_physical_plan::collect;
use std::{fs, sync::Arc};
use tempfile::TempDir;
+ use url::Url;
#[tokio::test]
async fn can_override_physical_expr_adapter() {
@@ -103,7 +104,8 @@ mod tests {
writer.write(&rec_batch).unwrap();
writer.close().unwrap();
- let location = Path::parse(path.to_str().unwrap()).unwrap();
+ let url = Url::from_file_path(path.canonicalize().unwrap()).unwrap();
+ let location = Path::from_url_path(url.path()).unwrap();
let metadata = fs::metadata(path.as_path()).expect("Local file metadata");
let meta = ObjectMeta {
location,