]> granicus.if.org Git - python/commitdiff
test_io: ignore DeprecationWarning on bytes path on Windows
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 25 Mar 2016 08:07:07 +0000 (09:07 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 25 Mar 2016 08:07:07 +0000 (09:07 +0100)
Lib/test/test_io.py

index 37b9b2d3a4e8dc65626647e4bd1ffb44f967a47c..db074cab1544511a69ff43db127f0d5c69e344be 100644 (file)
@@ -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: