@@ -147,7 +147,7 @@ def test_large_icc_meta(self, tmp_path):
147147 with Image .open ("Tests/images/icc_profile_big.jpg" ) as im :
148148 f = str (tmp_path / "temp.jpg" )
149149 icc_profile = im .info ["icc_profile" ]
150- # Should not raise IOError for image with icc larger than image size.
150+ # Should not raise OSError for image with icc larger than image size.
151151 im .save (
152152 f ,
153153 format = "JPEG" ,
@@ -379,14 +379,14 @@ def test_truncated_jpeg_should_read_all_the_data(self):
379379 ImageFile .LOAD_TRUNCATED_IMAGES = False
380380 assert im .getbbox () is not None
381381
382- def test_truncated_jpeg_throws_IOError (self ):
382+ def test_truncated_jpeg_throws_oserror (self ):
383383 filename = "Tests/images/truncated_jpeg.jpg"
384384 with Image .open (filename ) as im :
385- with pytest .raises (IOError ):
385+ with pytest .raises (OSError ):
386386 im .load ()
387387
388388 # Test that the error is raised if loaded a second time
389- with pytest .raises (IOError ):
389+ with pytest .raises (OSError ):
390390 im .load ()
391391
392392 def test_qtables (self , tmp_path ):
@@ -552,7 +552,7 @@ def test_save_wrong_modes(self):
552552 out = BytesIO ()
553553 for mode in ["LA" , "La" , "RGBA" , "RGBa" , "P" ]:
554554 img = Image .new (mode , (20 , 20 ))
555- with pytest .raises (IOError ):
555+ with pytest .raises (OSError ):
556556 img .save (out , "JPEG" )
557557
558558 def test_save_tiff_with_dpi (self , tmp_path ):
@@ -702,7 +702,7 @@ def test_fd_leak(self, tmp_path):
702702 im = Image .open (tmpfile )
703703 fp = im .fp
704704 assert not fp .closed
705- with pytest .raises (WindowsError ):
705+ with pytest .raises (OSError ):
706706 os .remove (tmpfile )
707707 im .load ()
708708 assert fp .closed
0 commit comments