Skip to content

Commit 53c5e30

Browse files
johnff9fangchenli
andauthored
TST: Replace ensure_clean_store with tmp_path in tests/io/pytables/te… (#63056)
Co-authored-by: Fangchen Li <[email protected]>
1 parent bb2e215 commit 53c5e30

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

pandas/tests/io/pytables/test_keys.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@
88
Series,
99
date_range,
1010
)
11-
from pandas.tests.io.pytables.common import (
12-
ensure_clean_store,
13-
tables,
14-
)
11+
from pandas.tests.io.pytables.common import tables
1512

1613
pytestmark = [pytest.mark.single_cpu]
1714

1815

19-
def test_keys(setup_path):
20-
with ensure_clean_store(setup_path) as store:
16+
def test_keys(tmp_path):
17+
path = tmp_path / "test_keys.h5"
18+
with HDFStore(path) as store:
2119
store["a"] = Series(
2220
np.arange(10, dtype=np.float64), index=date_range("2020-01-01", periods=10)
2321
)
@@ -62,20 +60,21 @@ class Table3(tables.IsDescription):
6260
assert len(df.columns) == 1
6361

6462

65-
def test_keys_illegal_include_keyword_value(setup_path):
66-
with ensure_clean_store(setup_path) as store:
63+
def test_keys_illegal_include_keyword_value(tmp_path):
64+
path = tmp_path / "test_keys_illegal_include_keyword_value.h5"
65+
with HDFStore(path) as store:
6766
with pytest.raises(
6867
ValueError,
6968
match="`include` should be either 'pandas' or 'native' but is 'illegal'",
7069
):
7170
store.keys(include="illegal")
7271

7372

74-
def test_keys_ignore_hdf_softlink(setup_path):
73+
def test_keys_ignore_hdf_softlink(tmp_path):
7574
# GH 20523
7675
# Puts a softlink into HDF file and rereads
77-
78-
with ensure_clean_store(setup_path) as store:
76+
path = tmp_path / "test_keys_ignore_hdf_softlink.h5"
77+
with HDFStore(path) as store:
7978
df = DataFrame({"A": range(5), "B": range(5)})
8079
store.put("df", df)
8180

0 commit comments

Comments
 (0)