From 3757d904dd1dc017e3b74ebda42991ee1a781d7e Mon Sep 17 00:00:00 2001 From: Sumeet Bhatnagar Date: Mon, 13 Oct 2025 21:30:35 -0400 Subject: [PATCH 1/2] Remove ensure_clean_store reference from test_retain_attributes.py --- pandas/tests/io/pytables/test_retain_attributes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/tests/io/pytables/test_retain_attributes.py b/pandas/tests/io/pytables/test_retain_attributes.py index ab8dcacc4b8d4..d685cf8eb68f7 100644 --- a/pandas/tests/io/pytables/test_retain_attributes.py +++ b/pandas/tests/io/pytables/test_retain_attributes.py @@ -3,6 +3,7 @@ from pandas import ( DataFrame, DatetimeIndex, + HDFStore, Series, _testing as tm, date_range, @@ -11,18 +12,17 @@ ) from pandas.tests.io.pytables.common import ( _maybe_remove, - ensure_clean_store, ) pytestmark = pytest.mark.single_cpu -def test_retain_index_attributes(setup_path, unit): +def test_retain_index_attributes(temp_file, unit): # GH 3499, losing frequency info on index recreation dti = date_range("2000-1-1", periods=3, freq="h", unit=unit) df = DataFrame({"A": Series(range(3), index=dti)}) - with ensure_clean_store(setup_path) as store: + with HDFStore(temp_file) as store: _maybe_remove(store, "data") store.put("data", df, format="table") From aee55adea25cd952a6d83928296d340da1ce7057 Mon Sep 17 00:00:00 2001 From: Sumeet Bhatnagar Date: Mon, 13 Oct 2025 21:57:31 -0400 Subject: [PATCH 2/2] Remove ensure_clean_store reference from test_read.py --- pandas/tests/io/pytables/test_read.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pandas/tests/io/pytables/test_read.py b/pandas/tests/io/pytables/test_read.py index 7a3a7339e7809..70696a502a111 100644 --- a/pandas/tests/io/pytables/test_read.py +++ b/pandas/tests/io/pytables/test_read.py @@ -19,7 +19,6 @@ ) from pandas.tests.io.pytables.common import ( _maybe_remove, - ensure_clean_store, ) from pandas.io.pytables import TableIterator @@ -70,14 +69,14 @@ def test_read_missing_key_opened_store(tmp_path, setup_path): read_hdf(store, "k1") -def test_read_column(setup_path): +def test_read_column(temp_file): df = DataFrame( np.random.default_rng(2).standard_normal((10, 4)), columns=Index(list("ABCD")), index=date_range("2000-01-01", periods=10, freq="B"), ) - with ensure_clean_store(setup_path) as store: + with HDFStore(temp_file) as store: _maybe_remove(store, "df") # GH 17912 @@ -153,7 +152,7 @@ def test_read_column(setup_path): def test_pytables_native_read(datapath): - with ensure_clean_store( + with HDFStore( datapath("io", "data", "legacy_hdf/pytables_native.h5"), mode="r" ) as store: d2 = store["detector/readout"] @@ -162,7 +161,7 @@ def test_pytables_native_read(datapath): @pytest.mark.skipif(is_platform_windows(), reason="native2 read fails oddly on windows") def test_pytables_native2_read(datapath): - with ensure_clean_store( + with HDFStore( datapath("io", "data", "legacy_hdf", "pytables_native2.h5"), mode="r" ) as store: str(store)