Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-37223: test_io: silence destructor errors #13954

Merged
merged 1 commit into from
Jun 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Lib/test/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down