44import pandas as pd
55from pandas import (
66 DataFrame ,
7+ HDFStore ,
78 Series ,
89)
910import pandas ._testing as tm
10- from pandas .tests .io .pytables .common import ensure_clean_store
1111
1212from pandas .io .pytables import read_hdf
1313
@@ -103,7 +103,7 @@ def test_complex_mixed_table(tmp_path, setup_path):
103103 index = list ("abcd" ),
104104 )
105105
106- with ensure_clean_store ( setup_path ) as store :
106+ with HDFStore ( tmp_path / setup_path ) as store :
107107 store .append ("df" , df , data_columns = ["A" , "B" ])
108108 result = store .select ("df" , where = "A>2" )
109109 tm .assert_frame_equal (df .loc [df .A > 2 ], result )
@@ -139,7 +139,7 @@ def test_complex_across_dimensions(tmp_path, setup_path):
139139 tm .assert_frame_equal (df , reread )
140140
141141
142- def test_complex_indexing_error (setup_path ):
142+ def test_complex_indexing_error (tmp_path , setup_path ):
143143 complex128 = np .array (
144144 [1.0 + 1.0j , 1.0 + 1.0j , 1.0 + 1.0j , 1.0 + 1.0j ], dtype = np .complex128
145145 )
@@ -156,7 +156,7 @@ def test_complex_indexing_error(setup_path):
156156 "values to data_columns when initializing the table."
157157 )
158158
159- with ensure_clean_store ( setup_path ) as store :
159+ with HDFStore ( tmp_path / setup_path ) as store :
160160 with pytest .raises (TypeError , match = msg ):
161161 store .append ("df" , df , data_columns = ["C" ])
162162
@@ -183,15 +183,15 @@ def test_complex_series_error(tmp_path, setup_path):
183183 tm .assert_series_equal (s , reread )
184184
185185
186- def test_complex_append (setup_path ):
186+ def test_complex_append (tmp_path , setup_path ):
187187 df = DataFrame (
188188 {
189189 "a" : np .random .default_rng (2 ).standard_normal (100 ).astype (np .complex128 ),
190190 "b" : np .random .default_rng (2 ).standard_normal (100 ),
191191 }
192192 )
193193
194- with ensure_clean_store ( setup_path ) as store :
194+ with HDFStore ( tmp_path / setup_path ) as store :
195195 store .append ("df" , df , data_columns = ["b" ])
196196 store .append ("df" , df )
197197 result = store .select ("df" )
0 commit comments