Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 47b4557

Browse files
committed
test_io: ignore DeprecationWarning on bytes path on Windows
1 parent 633ebda commit 47b4557

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/test/test_io.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,11 @@ def test_invalid_operations(self):
364364
def test_open_handles_NUL_chars(self):
365365
fn_with_NUL = 'foo\0bar'
366366
self.assertRaises(ValueError, self.open, fn_with_NUL, 'w')
367-
self.assertRaises(ValueError, self.open, bytes(fn_with_NUL, 'ascii'), 'w')
367+
368+
bytes_fn = bytes(fn_with_NUL, 'ascii')
369+
with warnings.catch_warnings():
370+
warnings.simplefilter("ignore", DeprecationWarning)
371+
self.assertRaises(ValueError, self.open, bytes_fn, 'w')
368372

369373
def test_raw_file_io(self):
370374
with self.open(support.TESTFN, "wb", buffering=0) as f:

0 commit comments

Comments
 (0)