From 47b4557679154a645780b2e44dd7a4a2c62b5d12 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 25 Mar 2016 09:07:07 +0100 Subject: test_io: ignore DeprecationWarning on bytes path on Windows --- Lib/test/test_io.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 37b9b2d..db074ca 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -364,7 +364,11 @@ class IOTest(unittest.TestCase): def test_open_handles_NUL_chars(self): fn_with_NUL = 'foo\0bar' self.assertRaises(ValueError, self.open, fn_with_NUL, 'w') - self.assertRaises(ValueError, self.open, bytes(fn_with_NUL, 'ascii'), 'w') + + bytes_fn = bytes(fn_with_NUL, 'ascii') + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + self.assertRaises(ValueError, self.open, bytes_fn, 'w') def test_raw_file_io(self): with self.open(support.TESTFN, "wb", buffering=0) as f: -- cgit v0.12