Skip to content

Commit 1efb8c3

Browse files
authored
Remove ensure_clean_store reference from test_retain_attributes.py, test_read.py (#62688)
1 parent f38f1e9 commit 1efb8c3

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

pandas/tests/io/pytables/test_read.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
)
2020
from pandas.tests.io.pytables.common import (
2121
_maybe_remove,
22-
ensure_clean_store,
2322
)
2423

2524
from pandas.io.pytables import TableIterator
@@ -70,14 +69,14 @@ def test_read_missing_key_opened_store(tmp_path, setup_path):
7069
read_hdf(store, "k1")
7170

7271

73-
def test_read_column(setup_path):
72+
def test_read_column(temp_file):
7473
df = DataFrame(
7574
np.random.default_rng(2).standard_normal((10, 4)),
7675
columns=Index(list("ABCD")),
7776
index=date_range("2000-01-01", periods=10, freq="B"),
7877
)
7978

80-
with ensure_clean_store(setup_path) as store:
79+
with HDFStore(temp_file) as store:
8180
_maybe_remove(store, "df")
8281

8382
# GH 17912
@@ -153,7 +152,7 @@ def test_read_column(setup_path):
153152

154153

155154
def test_pytables_native_read(datapath):
156-
with ensure_clean_store(
155+
with HDFStore(
157156
datapath("io", "data", "legacy_hdf/pytables_native.h5"), mode="r"
158157
) as store:
159158
d2 = store["detector/readout"]
@@ -162,7 +161,7 @@ def test_pytables_native_read(datapath):
162161

163162
@pytest.mark.skipif(is_platform_windows(), reason="native2 read fails oddly on windows")
164163
def test_pytables_native2_read(datapath):
165-
with ensure_clean_store(
164+
with HDFStore(
166165
datapath("io", "data", "legacy_hdf", "pytables_native2.h5"), mode="r"
167166
) as store:
168167
str(store)

pandas/tests/io/pytables/test_retain_attributes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pandas import (
44
DataFrame,
55
DatetimeIndex,
6+
HDFStore,
67
Series,
78
_testing as tm,
89
date_range,
@@ -11,18 +12,17 @@
1112
)
1213
from pandas.tests.io.pytables.common import (
1314
_maybe_remove,
14-
ensure_clean_store,
1515
)
1616

1717
pytestmark = pytest.mark.single_cpu
1818

1919

20-
def test_retain_index_attributes(setup_path, unit):
20+
def test_retain_index_attributes(temp_file, unit):
2121
# GH 3499, losing frequency info on index recreation
2222
dti = date_range("2000-1-1", periods=3, freq="h", unit=unit)
2323
df = DataFrame({"A": Series(range(3), index=dti)})
2424

25-
with ensure_clean_store(setup_path) as store:
25+
with HDFStore(temp_file) as store:
2626
_maybe_remove(store, "data")
2727
store.put("data", df, format="table")
2828

0 commit comments

Comments
 (0)