@@ -161,30 +161,28 @@ def test_reopen_handle(tmp_path, setup_path):
161161 assert not store .is_open
162162
163163
164- def test_open_args (setup_path , using_infer_string ):
165- with tm . ensure_clean ( setup_path ) as path :
166- df = DataFrame (
167- 1.1 * np .arange (120 ).reshape ((30 , 4 )),
168- columns = Index (list ("ABCD" ), dtype = object ),
169- index = Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
170- )
164+ def test_open_args (tmp_path , setup_path , using_infer_string ):
165+ path = tmp_path / setup_path
166+ df = DataFrame (
167+ 1.1 * np .arange (120 ).reshape ((30 , 4 )),
168+ columns = Index (list ("ABCD" ), dtype = object ),
169+ index = Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
170+ )
171171
172- # create an in memory store
173- store = HDFStore (
174- path , mode = "a" , driver = "H5FD_CORE" , driver_core_backing_store = 0
175- )
176- store ["df" ] = df
177- store .append ("df2" , df )
172+ # create an in memory store
173+ store = HDFStore (path , mode = "a" , driver = "H5FD_CORE" , driver_core_backing_store = 0 )
174+ store ["df" ] = df
175+ store .append ("df2" , df )
178176
179- expected = df .copy ()
180- if using_infer_string :
181- expected .index = expected .index .astype ("str" )
182- expected .columns = expected .columns .astype ("str" )
177+ expected = df .copy ()
178+ if using_infer_string :
179+ expected .index = expected .index .astype ("str" )
180+ expected .columns = expected .columns .astype ("str" )
183181
184- tm .assert_frame_equal (store ["df" ], expected )
185- tm .assert_frame_equal (store ["df2" ], expected )
182+ tm .assert_frame_equal (store ["df" ], expected )
183+ tm .assert_frame_equal (store ["df2" ], expected )
186184
187- store .close ()
185+ store .close ()
188186
189187 # the file should not have actually been written
190188 assert not os .path .exists (path )
@@ -507,7 +505,7 @@ def test_multiple_open_close(tmp_path, setup_path):
507505 store .df
508506
509507
510- def test_fspath ():
511- with tm . ensure_clean ( "foo.h5" ) as path :
512- with HDFStore (path ) as store :
513- assert os .fspath (store ) == str (path )
508+ def test_fspath (tmp_path ):
509+ path = tmp_path / "foo.h5"
510+ with HDFStore (path ) as store :
511+ assert os .fspath (store ) == str (path )
0 commit comments