From: Victor Stinner Date: Fri, 25 Mar 2016 08:07:07 +0000 (+0100) Subject: test_io: ignore DeprecationWarning on bytes path on Windows X-Git-Tag: v3.6.0a1~339 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47b4557679154a645780b2e44dd7a4a2c62b5d12;p=python test_io: ignore DeprecationWarning on bytes path on Windows --- diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 37b9b2d3a4..db074cab15 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: