Commit a53bee51 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #21934: test_file2k no longer create regular file /dev/full on OpenBSD

when run as root.  Extended testing with /dev/full.
Based on patch by Daniel Dickman.
parent 319480b7
...@@ -4,6 +4,7 @@ import unittest ...@@ -4,6 +4,7 @@ import unittest
import itertools import itertools
import select import select
import signal import signal
import stat
import subprocess import subprocess
import time import time
from array import array from array import array
...@@ -430,17 +431,22 @@ class OtherFileTests(unittest.TestCase): ...@@ -430,17 +431,22 @@ class OtherFileTests(unittest.TestCase):
@unittest.skipUnless(os.name == 'posix', 'test requires a posix system.') @unittest.skipUnless(os.name == 'posix', 'test requires a posix system.')
def test_write_full(self): def test_write_full(self):
# Issue #17976 devfull = '/dev/full'
try: if not (os.path.exists(devfull) and
f = open('/dev/full', 'w', 1) stat.S_ISCHR(os.stat(devfull).st_mode)):
except IOError: # Issue #21934: OpenBSD does not have a /dev/full character device
self.skipTest("requires '/dev/full'") self.skipTest('requires %r' % devfull)
try: 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): with self.assertRaises(IOError):
# Issue #17976
f.write('hello') f.write('hello')
f.write('\n') f.write('\n')
finally: with open(devfull, 'wb', 0) as f:
f.close() with self.assertRaises(IOError):
f.write('h')
@unittest.skipUnless(sys.maxsize > 2**31, "requires 64-bit system") @unittest.skipUnless(sys.maxsize > 2**31, "requires 64-bit system")
@test_support.precisionbigmemtest(2**31, 2.5, dry_run=False) @test_support.precisionbigmemtest(2**31, 2.5, dry_run=False)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment