Skip to content

Commit 61ba5f8

Browse files
authored
CI: Change flaky to_excel test to compare DataFrames (#49509)
1 parent 60209e5 commit 61ba5f8

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

pandas/tests/io/test_common.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,18 @@ def test_write_fspath_all(self, writer_name, writer_kwargs, module):
359359
writer = getattr(df, writer_name)
360360

361361
writer(string, **writer_kwargs)
362-
with open(string, "rb") as f:
363-
expected = f.read()
364-
365362
writer(mypath, **writer_kwargs)
366-
with open(fspath, "rb") as f:
367-
result = f.read()
368-
369-
assert result == expected
363+
with open(string, "rb") as f_str, open(fspath, "rb") as f_path:
364+
if writer == "to_excel":
365+
# binary representation of excel contains time creation
366+
# data that causes flaky CI failures
367+
result = pd.read_excel(f_str, **writer_kwargs)
368+
expected = pd.read_excel(f_path, **writer_kwargs)
369+
tm.assert_frame_equal(result, expected)
370+
else:
371+
result = f_str.read()
372+
expected = f_path.read()
373+
assert result == expected
370374

371375
@pytest.mark.filterwarnings( # pytables np.object usage
372376
"ignore:`np.object` is a deprecated alias:DeprecationWarning"

0 commit comments

Comments
 (0)