[Python-checkins] cpython (2.7): Issue #21934: test_file2k no longer create regular file /dev/full on OpenBSD
serhiy.storchaka
python-checkins at python.org
Sun Feb 15 12:26:47 CET 2015
https://hg.python.org/cpython/rev/354c3b65e245
changeset: 94625:354c3b65e245
branch: 2.7
parent: 94619:dfe75713f152
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sun Feb 15 13:05:10 2015 +0200
summary:
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.
files:
Lib/test/test_file2k.py | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/Lib/test/test_file2k.py b/Lib/test/test_file2k.py
--- a/Lib/test/test_file2k.py
+++ b/Lib/test/test_file2k.py
@@ -4,6 +4,7 @@
import itertools
import select
import signal
+import stat
import subprocess
import time
from array import array
@@ -430,17 +431,22 @@
@unittest.skipUnless(os.name == 'posix', 'test requires a posix system.')
def test_write_full(self):
- # Issue #17976
- try:
- f = open('/dev/full', 'w', 1)
- except IOError:
- self.skipTest("requires '/dev/full'")
- try:
+ 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')
- finally:
- f.close()
+ with open(devfull, 'wb', 0) as f:
+ with self.assertRaises(IOError):
+ f.write('h')
@unittest.skipUnless(sys.maxsize > 2**31, "requires 64-bit system")
@test_support.precisionbigmemtest(2**31, 2.5, dry_run=False)
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list