summaryrefslogtreecommitdiff
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-11 03:10:59 +0200
committerGitHub <noreply@github.com>2019-06-11 03:10:59 +0200
commitb589cef9c4dada2fb84ce0fae5040ecf16d9d5ef (patch)
treeed1f5300d8bc38587c0856be49c3828291333c9d /Lib/test/test_io.py
parent4f6f7c5a611905fb6b81671547f268c226bc646a (diff)
downloadcpython-git-b589cef9c4dada2fb84ce0fae5040ecf16d9d5ef.tar.gz
bpo-37223: test_io: silence destructor errors (GH-13954)
Implement also MockNonBlockWriterIO.seek() method.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 3a1f5ba5b6..102679b1d3 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -277,6 +277,10 @@ class MockNonBlockWriterIO:
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 @@ class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
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 @@ class BufferedWriterTest(unittest.TestCase, CommonBufferedTests):
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)