[Python-checkins] cpython: test_io: ignore DeprecationWarning on bytes path on Windows

victor.stinner python-checkins at python.org
Fri Mar 25 04:07:55 EDT 2016


https://hg.python.org/cpython/rev/dd2a06deedd7
changeset:   100734:dd2a06deedd7
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Mar 25 09:07:07 2016 +0100
summary:
  test_io: ignore DeprecationWarning on bytes path on Windows

files:
  Lib/test/test_io.py |  6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -364,7 +364,11 @@
     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:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list