From b22b922412930a1bde4953904cc0e15ab66fd2d9 Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Thu, 27 Nov 2025 12:19:46 -0500 Subject: [PATCH 01/13] Replace ensure_clean_store with tmp_path fixture in test_file_handling.py --- pandas/tests/io/pytables/test_file_handling.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pandas/tests/io/pytables/test_file_handling.py b/pandas/tests/io/pytables/test_file_handling.py index 2ea2ac632c992..94cba10efcc64 100644 --- a/pandas/tests/io/pytables/test_file_handling.py +++ b/pandas/tests/io/pytables/test_file_handling.py @@ -24,7 +24,6 @@ ) from pandas.tests.io.pytables.common import ( _maybe_remove, - ensure_clean_store, tables, ) @@ -188,8 +187,8 @@ def test_open_args(tmp_path, setup_path, using_infer_string): assert not os.path.exists(path) -def test_flush(setup_path): - with ensure_clean_store(setup_path) as store: +def test_flush(tmp_path, setup_path): + with HDFStore(tmp_path / setup_path) as store: store["a"] = Series(range(5)) store.flush() store.flush(fsync=True) @@ -316,8 +315,8 @@ def test_complibs(tmp_path, lvl, lib, request): @pytest.mark.skipif( not is_platform_little_endian(), reason="reason platform is not little endian" ) -def test_encoding(setup_path): - with ensure_clean_store(setup_path) as store: +def test_encoding(tmp_path, setup_path): + with HDFStore(tmp_path / setup_path) as store: df = DataFrame({"A": "foo", "B": "bar"}, index=range(5)) df.loc[2, "A"] = np.nan df.loc[3, "B"] = np.nan From 49fcbd16525862120424f5dfc85fc5217ec5f5bb Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Fri, 28 Nov 2025 21:33:42 -0500 Subject: [PATCH 02/13] Update test_complex.py to check for tests --- pandas/tests/io/pytables/test_complex.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/tests/io/pytables/test_complex.py b/pandas/tests/io/pytables/test_complex.py index 80e7664d1969e..ec52e904fadf7 100644 --- a/pandas/tests/io/pytables/test_complex.py +++ b/pandas/tests/io/pytables/test_complex.py @@ -7,6 +7,7 @@ Series, ) import pandas._testing as tm + from pandas.tests.io.pytables.common import ensure_clean_store from pandas.io.pytables import read_hdf From 8e5ef6787dd04d691d4015dab8966882e4d9593f Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Fri, 28 Nov 2025 22:37:10 -0500 Subject: [PATCH 03/13] Fix isort failure in test_complex.py --- pandas/tests/io/pytables/test_complex.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/tests/io/pytables/test_complex.py b/pandas/tests/io/pytables/test_complex.py index ec52e904fadf7..80e7664d1969e 100644 --- a/pandas/tests/io/pytables/test_complex.py +++ b/pandas/tests/io/pytables/test_complex.py @@ -7,7 +7,6 @@ Series, ) import pandas._testing as tm - from pandas.tests.io.pytables.common import ensure_clean_store from pandas.io.pytables import read_hdf From 7c646a64757365bd6a01b7c2df9e64d9c4da28b2 Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Fri, 28 Nov 2025 23:59:36 -0500 Subject: [PATCH 04/13] Replace ensure_clean_store with new fixture in test_complex.py Add HDFStore and remove ensure_clean_store imports, use tmp_path / setup_path with HDFStore instead. --- pandas/tests/io/pytables/test_complex.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/pandas/tests/io/pytables/test_complex.py b/pandas/tests/io/pytables/test_complex.py index 80e7664d1969e..735ef2cc41a87 100644 --- a/pandas/tests/io/pytables/test_complex.py +++ b/pandas/tests/io/pytables/test_complex.py @@ -7,9 +7,11 @@ Series, ) import pandas._testing as tm -from pandas.tests.io.pytables.common import ensure_clean_store +from pandas.io.pytables import ( + HDFStore, + read_hdf, +) -from pandas.io.pytables import read_hdf def test_complex_fixed(tmp_path, setup_path): @@ -103,11 +105,13 @@ def test_complex_mixed_table(tmp_path, setup_path): index=list("abcd"), ) - with ensure_clean_store(setup_path) as store: + path = tmp_path / setup_path + with HDFStore(path) as store: store.append("df", df, data_columns=["A", "B"]) result = store.select("df", where="A>2") tm.assert_frame_equal(df.loc[df.A > 2], result) + path = tmp_path / setup_path df.to_hdf(path, key="df", format="table") reread = read_hdf(path, "df") @@ -139,7 +143,7 @@ def test_complex_across_dimensions(tmp_path, setup_path): tm.assert_frame_equal(df, reread) -def test_complex_indexing_error(setup_path): +def test_complex_indexing_error(tmp_path, setup_path): complex128 = np.array( [1.0 + 1.0j, 1.0 + 1.0j, 1.0 + 1.0j, 1.0 + 1.0j], dtype=np.complex128 ) @@ -156,11 +160,13 @@ def test_complex_indexing_error(setup_path): "values to data_columns when initializing the table." ) - with ensure_clean_store(setup_path) as store: + path = tmp_path / setup_path + with HDFStore(path) as store: with pytest.raises(TypeError, match=msg): store.append("df", df, data_columns=["C"]) + def test_complex_series_error(tmp_path, setup_path): complex128 = np.array([1.0 + 1.0j, 1.0 + 1.0j, 1.0 + 1.0j, 1.0 + 1.0j]) s = Series(complex128, index=list("abcd")) @@ -183,7 +189,7 @@ def test_complex_series_error(tmp_path, setup_path): tm.assert_series_equal(s, reread) -def test_complex_append(setup_path): +def test_complex_append(tmp_path, setup_path): df = DataFrame( { "a": np.random.default_rng(2).standard_normal(100).astype(np.complex128), @@ -191,8 +197,10 @@ def test_complex_append(setup_path): } ) - with ensure_clean_store(setup_path) as store: + path = tmp_path / setup_path + with HDFStore(path, mode="a") as store: store.append("df", df, data_columns=["b"]) store.append("df", df) result = store.select("df") tm.assert_frame_equal(pd.concat([df, df], axis=0), result) + From 08d4b9100543b63cb89fbc09ff7bb67c99f9f4cc Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Sat, 29 Nov 2025 00:05:47 -0500 Subject: [PATCH 05/13] Fix import ordering for pre-commit.ci test --- pandas/tests/io/pytables/test_complex.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pandas/tests/io/pytables/test_complex.py b/pandas/tests/io/pytables/test_complex.py index 735ef2cc41a87..b2c63616bcd27 100644 --- a/pandas/tests/io/pytables/test_complex.py +++ b/pandas/tests/io/pytables/test_complex.py @@ -2,18 +2,15 @@ import pytest import pandas as pd +import pandas._testing as tm from pandas import ( DataFrame, - Series, -) -import pandas._testing as tm -from pandas.io.pytables import ( HDFStore, + Series, read_hdf, ) - def test_complex_fixed(tmp_path, setup_path): df = DataFrame( np.random.default_rng(2).random((4, 5)).astype(np.complex64), From e470c38ec2e77f59a278c9bd230e051b54e48c4c Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Sat, 29 Nov 2025 00:45:02 -0500 Subject: [PATCH 06/13] Fix pytables import in test_complex.py --- pandas/tests/io/pytables/test_complex.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pandas/tests/io/pytables/test_complex.py b/pandas/tests/io/pytables/test_complex.py index b2c63616bcd27..41fde2a86d6e6 100644 --- a/pandas/tests/io/pytables/test_complex.py +++ b/pandas/tests/io/pytables/test_complex.py @@ -1,14 +1,16 @@ import numpy as np import pytest +import tables + import pandas as pd -import pandas._testing as tm from pandas import ( DataFrame, HDFStore, Series, read_hdf, ) +import pandas._testing as tm def test_complex_fixed(tmp_path, setup_path): @@ -108,7 +110,6 @@ def test_complex_mixed_table(tmp_path, setup_path): result = store.select("df", where="A>2") tm.assert_frame_equal(df.loc[df.A > 2], result) - path = tmp_path / setup_path df.to_hdf(path, key="df", format="table") reread = read_hdf(path, "df") @@ -163,7 +164,6 @@ def test_complex_indexing_error(tmp_path, setup_path): store.append("df", df, data_columns=["C"]) - def test_complex_series_error(tmp_path, setup_path): complex128 = np.array([1.0 + 1.0j, 1.0 + 1.0j, 1.0 + 1.0j, 1.0 + 1.0j]) s = Series(complex128, index=list("abcd")) @@ -200,4 +200,3 @@ def test_complex_append(tmp_path, setup_path): store.append("df", df) result = store.select("df") tm.assert_frame_equal(pd.concat([df, df], axis=0), result) - From 7e5acef30585cec1e120f7176cefa995d7984690 Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Sat, 29 Nov 2025 01:08:01 -0500 Subject: [PATCH 07/13] Fix CI failures due to imports in test_complex.py --- pandas/tests/io/pytables/test_complex.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pandas/tests/io/pytables/test_complex.py b/pandas/tests/io/pytables/test_complex.py index 41fde2a86d6e6..65a7d34e70094 100644 --- a/pandas/tests/io/pytables/test_complex.py +++ b/pandas/tests/io/pytables/test_complex.py @@ -1,16 +1,17 @@ import numpy as np import pytest -import tables - import pandas as pd +import pandas._testing as tm from pandas import ( DataFrame, HDFStore, Series, read_hdf, ) -import pandas._testing as tm + + +tables = pytest.importorskip("tables") def test_complex_fixed(tmp_path, setup_path): From 3056390393419f9c981e7f85b538bec3adf88d11 Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Sat, 29 Nov 2025 10:48:29 -0500 Subject: [PATCH 08/13] Fix typing error (specifically, isort) in test_complex.py --- pandas/tests/io/pytables/test_complex.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/tests/io/pytables/test_complex.py b/pandas/tests/io/pytables/test_complex.py index 65a7d34e70094..16ca4f20b15ff 100644 --- a/pandas/tests/io/pytables/test_complex.py +++ b/pandas/tests/io/pytables/test_complex.py @@ -2,14 +2,13 @@ import pytest import pandas as pd -import pandas._testing as tm from pandas import ( DataFrame, HDFStore, Series, read_hdf, ) - +import pandas._testing as tm tables = pytest.importorskip("tables") From 6b4b9e7f92f6a1f0d147d3a93bf0fc886531f01e Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Mon, 1 Dec 2025 17:00:28 -0500 Subject: [PATCH 09/13] Remove importorskip("tables") from test_complex.py --- pandas/tests/io/pytables/test_complex.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pandas/tests/io/pytables/test_complex.py b/pandas/tests/io/pytables/test_complex.py index 16ca4f20b15ff..d0c477c004661 100644 --- a/pandas/tests/io/pytables/test_complex.py +++ b/pandas/tests/io/pytables/test_complex.py @@ -10,8 +10,6 @@ ) import pandas._testing as tm -tables = pytest.importorskip("tables") - def test_complex_fixed(tmp_path, setup_path): df = DataFrame( From 06aaa4b6d1fc76043ca8101c5b68180e59c252a7 Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Mon, 1 Dec 2025 17:07:06 -0500 Subject: [PATCH 10/13] Retry microbamba error --- pandas/tests/io/pytables/test_complex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/io/pytables/test_complex.py b/pandas/tests/io/pytables/test_complex.py index d0c477c004661..0e65c6fbd59ee 100644 --- a/pandas/tests/io/pytables/test_complex.py +++ b/pandas/tests/io/pytables/test_complex.py @@ -8,7 +8,7 @@ Series, read_hdf, ) -import pandas._testing as tm +import pandas._testing as tm def test_complex_fixed(tmp_path, setup_path): From 5e53038c837f9838bd8659ea432e86a2d04bfcd8 Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Mon, 1 Dec 2025 18:11:18 -0500 Subject: [PATCH 11/13] Import pyables from pytables/common.py --- pandas/tests/io/pytables/test_complex.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandas/tests/io/pytables/test_complex.py b/pandas/tests/io/pytables/test_complex.py index 0e65c6fbd59ee..69d01a56e9531 100644 --- a/pandas/tests/io/pytables/test_complex.py +++ b/pandas/tests/io/pytables/test_complex.py @@ -8,7 +8,10 @@ Series, read_hdf, ) -import pandas._testing as tm +import pandas._testing as tm +from pandas.tests.io.pytables.common import tables + +_ = tables def test_complex_fixed(tmp_path, setup_path): From 1c4afb4a24c3ab5def4c24a03cf9cbc5ca1bb3b5 Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Mon, 1 Dec 2025 18:36:39 -0500 Subject: [PATCH 12/13] Update to resolve microbamba error --- pandas/tests/io/pytables/test_complex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/io/pytables/test_complex.py b/pandas/tests/io/pytables/test_complex.py index 69d01a56e9531..26a0c0f508963 100644 --- a/pandas/tests/io/pytables/test_complex.py +++ b/pandas/tests/io/pytables/test_complex.py @@ -9,7 +9,7 @@ read_hdf, ) import pandas._testing as tm -from pandas.tests.io.pytables.common import tables +from pandas.tests.io.pytables.common import tables _ = tables From 709b6c3a4e8c4f09448b87b1fab9ae13213b71bc Mon Sep 17 00:00:00 2001 From: oganesssson <265micolca@gmail.com> Date: Mon, 1 Dec 2025 19:00:41 -0500 Subject: [PATCH 13/13] Remove tables import from test_complex.py --- pandas/tests/io/pytables/test_complex.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pandas/tests/io/pytables/test_complex.py b/pandas/tests/io/pytables/test_complex.py index 26a0c0f508963..d0c477c004661 100644 --- a/pandas/tests/io/pytables/test_complex.py +++ b/pandas/tests/io/pytables/test_complex.py @@ -9,9 +9,6 @@ read_hdf, ) import pandas._testing as tm -from pandas.tests.io.pytables.common import tables - -_ = tables def test_complex_fixed(tmp_path, setup_path):