|
26 | 26 | import shutil
|
27 | 27 | import sqlalchemy as sa
|
28 | 28 | import csv
|
| 29 | +import tempfile |
29 | 30 |
|
30 | 31 | from .utils import (
|
31 | 32 | check_file_leaks,
|
@@ -2014,14 +2015,18 @@ def test_HDFStore():
|
2014 | 2015 |
|
2015 | 2016 | assert isinstance(modin_store, pd.HDFStore)
|
2016 | 2017 |
|
2017 |
| - hdf_file = "/tmp/test_read_hdf.hdf5" |
2018 |
| - with pd.HDFStore(hdf_file, mode="w") as store: |
2019 |
| - store.append("data/df1", pd.DataFrame(np.random.randn(5, 5))) |
2020 |
| - store.append("data/df2", pd.DataFrame(np.random.randn(4, 4))) |
| 2018 | + handle, hdf_file = tempfile.mkstemp(suffix=".hdf5", prefix="test_read") |
| 2019 | + os.close(handle) |
| 2020 | + try: |
| 2021 | + with pd.HDFStore(hdf_file, mode="w") as store: |
| 2022 | + store.append("data/df1", pd.DataFrame(np.random.randn(5, 5))) |
| 2023 | + store.append("data/df2", pd.DataFrame(np.random.randn(4, 4))) |
2021 | 2024 |
|
2022 |
| - modin_df = pd.read_hdf(hdf_file, key="data/df1", mode="r") |
2023 |
| - pandas_df = pandas.read_hdf(hdf_file, key="data/df1", mode="r") |
2024 |
| - df_equals(modin_df, pandas_df) |
| 2025 | + modin_df = pd.read_hdf(hdf_file, key="data/df1", mode="r") |
| 2026 | + pandas_df = pandas.read_hdf(hdf_file, key="data/df1", mode="r") |
| 2027 | + df_equals(modin_df, pandas_df) |
| 2028 | + finally: |
| 2029 | + os.unlink(hdf_file) |
2025 | 2030 |
|
2026 | 2031 |
|
2027 | 2032 | def test_ExcelFile():
|
|
0 commit comments