def test_write_full(self):
devfull = '/dev/full'
if not (os.path.exists(devfull) and
stat.S_ISCHR(os.stat(devfull).st_mode)):
# Issue #21934: OpenBSD does not have a /dev/full character device
self.skipTest('requires %r' % devfull)
with open(devfull, 'wb', 1) as f:
with self.assertRaises(IOError):
f.write('hello\n')
with open(devfull, 'wb', 1) as f:
with self.assertRaises(IOError):
# Issue #17976
f.write('hello')
f.write('\n')
with open(devfull, 'wb', 0) as f:
with self.assertRaises(IOError):
f.write('h')
评论列表
文章目录