Skip to content

Commit

Permalink
FIX-#2527: Use random name for hdf file test, clean file after testing (
Browse files Browse the repository at this point in the history
#2528)

Signed-off-by: Vasilij Litvinov <vasilij.n.litvinov@intel.com>
  • Loading branch information
vnlitvinov authored Dec 10, 2020
1 parent 2592849 commit ecd41e5
Showing 1 changed file with 12 additions and 7 deletions.
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

0 comments on commit ecd41e5

Please sign in to comment.