Skip to content
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

FIX-#2527: Use random name for hdf file test, clean file after testing #2528

Merged
merged 1 commit into from
Dec 10, 2020
Merged
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
19 changes: 12 additions & 7 deletions modin/pandas/test/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import shutil
import sqlalchemy as sa
import csv
import tempfile

from .utils import (
check_file_leaks,
Expand Down Expand Up @@ -2014,14 +2015,18 @@ def test_HDFStore():

assert isinstance(modin_store, pd.HDFStore)

hdf_file = "/tmp/test_read_hdf.hdf5"
with pd.HDFStore(hdf_file, mode="w") as store:
store.append("data/df1", pd.DataFrame(np.random.randn(5, 5)))
store.append("data/df2", pd.DataFrame(np.random.randn(4, 4)))
handle, hdf_file = tempfile.mkstemp(suffix=".hdf5", prefix="test_read")
os.close(handle)
try:
with pd.HDFStore(hdf_file, mode="w") as store:
store.append("data/df1", pd.DataFrame(np.random.randn(5, 5)))
store.append("data/df2", pd.DataFrame(np.random.randn(4, 4)))

modin_df = pd.read_hdf(hdf_file, key="data/df1", mode="r")
pandas_df = pandas.read_hdf(hdf_file, key="data/df1", mode="r")
df_equals(modin_df, pandas_df)
modin_df = pd.read_hdf(hdf_file, key="data/df1", mode="r")
pandas_df = pandas.read_hdf(hdf_file, key="data/df1", mode="r")
df_equals(modin_df, pandas_df)
finally:
os.unlink(hdf_file)


def test_ExcelFile():
Expand Down