From ff6fe923ccf8889e69a6da582256d7a98efe3637 Mon Sep 17 00:00:00 2001 From: johnff9 <157079795+johnff9@users.noreply.github.com> Date: Sun, 9 Nov 2025 14:55:37 -0800 Subject: [PATCH] TST: Replace ensure_clean_store with tmp_path in tests/io/pytables/test_keys.py --- pandas/tests/io/pytables/test_keys.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pandas/tests/io/pytables/test_keys.py b/pandas/tests/io/pytables/test_keys.py index 9c5fc8786c7c6..0689fee6db1a5 100644 --- a/pandas/tests/io/pytables/test_keys.py +++ b/pandas/tests/io/pytables/test_keys.py @@ -9,15 +9,15 @@ date_range, ) from pandas.tests.io.pytables.common import ( - ensure_clean_store, - tables, + tables ) pytestmark = [pytest.mark.single_cpu] -def test_keys(setup_path): - with ensure_clean_store(setup_path) as store: +def test_keys(tmp_path): + path = tmp_path / "test_keys.h5" + with HDFStore(path) as store: store["a"] = Series( np.arange(10, dtype=np.float64), index=date_range("2020-01-01", periods=10) ) @@ -62,8 +62,9 @@ class Table3(tables.IsDescription): assert len(df.columns) == 1 -def test_keys_illegal_include_keyword_value(setup_path): - with ensure_clean_store(setup_path) as store: +def test_keys_illegal_include_keyword_value(tmp_path): + path = tmp_path / "test_keys_illegal_include_keyword_value.h5" + with HDFStore(path) as store: with pytest.raises( ValueError, match="`include` should be either 'pandas' or 'native' but is 'illegal'", @@ -71,11 +72,11 @@ def test_keys_illegal_include_keyword_value(setup_path): store.keys(include="illegal") -def test_keys_ignore_hdf_softlink(setup_path): +def test_keys_ignore_hdf_softlink(tmp_path): # GH 20523 # Puts a softlink into HDF file and rereads - - with ensure_clean_store(setup_path) as store: + path = tmp_path / "test_keys_ignore_hdf_softlink.h5" + with HDFStore(path) as store: df = DataFrame({"A": range(5), "B": range(5)}) store.put("df", df)