Skip to content

Commit c33b908

Browse files
committed
fix test on Windows by catching OSError
1 parent 288f527 commit c33b908

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Lib/test/test_wave.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from test import audiotests
33
from test import support
44
from test.support import os_helper
5+
import contextlib
56
import io
67
import struct
78
import sys
@@ -200,11 +201,9 @@ def test_read_wrong_sample_width(self):
200201
def test_write_to_protected_location(self):
201202
# gh-136523: Wave_write.__del__ should not throw
202203
with support.catch_unraisable_exception() as cm:
203-
try:
204+
with contextlib.suppress(OSError):
204205
with os_helper.temp_dir() as path:
205206
wave.open(path, "wb")
206-
except IsADirectoryError:
207-
pass
208207
support.gc_collect()
209208
self.assertIsNone(cm.unraisable)
210209

0 commit comments

Comments
 (0)