summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-25 09:07:07 +0100
committerVictor Stinner <victor.stinner@gmail.com>2016-03-25 09:07:07 +0100
commitce462e197579234cb7fd4da17f1d4b91a158953f (patch)
tree71775d825b3ca8a48d11ccde02b59fe7de558b1c
parent12868d45d643562f62bbbb54cf86274f8d119556 (diff)
downloadcpython-ce462e197579234cb7fd4da17f1d4b91a158953f.tar.gz
test_io: ignore DeprecationWarning on bytes path on Windows
-rw-r--r--Lib/test/test_io.py6
1 files changed, 5 insertions, 1 deletions
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: