Skip to content

Commit 828e1c1

Browse files
authored
fix: Make serialize_to_file test cross platform (#20147)
## Which issue does this PR close? - N/A. ## Rationale for this change Make the `serialize_to_file` substrait test work on different platforms. ## What changes are included in this PR? - Updated `serialize_to_file`. ## Are these changes tested? Yes. ## Are there any user-facing changes? No.
1 parent 23e2eee commit 828e1c1

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

datafusion/substrait/tests/cases/serialize.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#[cfg(test)]
1919
mod tests {
20-
use datafusion::common::assert_contains;
2120
use datafusion::datasource::provider_as_source;
2221
use datafusion::logical_expr::LogicalPlanBuilder;
2322
use datafusion_substrait::logical_plan::consumer::from_substrait_plan;
@@ -44,8 +43,18 @@ mod tests {
4443
serializer::deserialize(path).await?;
4544

4645
// Test case 2: serializing to an existing file should fail.
47-
let got = serializer::serialize(sql, &ctx, path).await.unwrap_err();
48-
assert_contains!(got.to_string(), "File exists");
46+
let got = serializer::serialize(sql, &ctx, path)
47+
.await
48+
.unwrap_err()
49+
.to_string();
50+
assert!(
51+
[
52+
"File exists", // unix
53+
"os error 80" // windows
54+
]
55+
.iter()
56+
.any(|s| got.contains(s))
57+
);
4958

5059
fs::remove_file(path)?;
5160

0 commit comments

Comments
 (0)