[Python-checkins] bpo-37223: test_io: silence destructor errors (GH-13954)
Victor Stinner
webhook-mailer at python.org
Mon Jun 10 21:11:03 EDT 2019
https://github.com/python/cpython/commit/b589cef9c4dada2fb84ce0fae5040ecf16d9d5ef
commit: b589cef9c4dada2fb84ce0fae5040ecf16d9d5ef
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-06-11T03:10:59+02:00
summary:
bpo-37223: test_io: silence destructor errors (GH-13954)
Implement also MockNonBlockWriterIO.seek() method.
files:
M Lib/test/test_io.py
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 3a1f5ba5b666..102679b1d342 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -277,6 +277,10 @@ def readable(self):
def seekable(self):
return True
+ def seek(self, pos, whence=0):
+ # naive implementation, enough for tests
+ return 0
+
def writable(self):
return True
@@ -1486,6 +1490,9 @@ def test_misbehaved_io(self):
self.assertRaises(OSError, bufio.seek, 0)
self.assertRaises(OSError, bufio.tell)
+ # Silence destructor error
+ bufio.close = lambda: None
+
def test_no_extraneous_read(self):
# Issue #9550; when the raw IO object has satisfied the read request,
# we should not issue any additional reads, otherwise it may block
@@ -1834,6 +1841,9 @@ def test_misbehaved_io(self):
self.assertRaises(OSError, bufio.tell)
self.assertRaises(OSError, bufio.write, b"abcdef")
+ # Silence destructor error
+ bufio.close = lambda: None
+
def test_max_buffer_size_removal(self):
with self.assertRaises(TypeError):
self.tp(self.MockRawIO(), 8, 12)
More information about the Python-checkins
mailing list