File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -630,15 +630,25 @@ def test_fail_mmap():
630630 icom .get_handle (buffer , "rb" , memory_map = True )
631631
632632
633- def read_chained_urls_no_errors ():
633+ def test_close_on_error ():
634+ # GH 47136
635+ class TestError :
636+ def close (self ):
637+ raise OSError ("test" )
638+
639+ with pytest .raises (OSError , match = "test" ):
640+ with BytesIO () as buffer :
641+ with icom .get_handle (buffer , "rb" ) as handles :
642+ handles .created_handles .append (TestError ())
643+
644+ def test_read_csv_chained_url_no_error ():
634645 tar_file = "pandas/tests/io/data/tar/test-csv.tar"
635646 try :
636647 pd .read_csv (f"tar://test.csv::file://{ tar_file } " , compression = None )
637648 pd .read_csv (f"tar://test.csv::file://{ tar_file } " , compression = "infer" )
638649 except Exception as e :
639650 pytest .fail (e )
640651
641-
642652@pytest .mark .parametrize (
643653 "reader" ,
644654 [
You can’t perform that action at this time.
0 commit comments