Skip test for issue #17976 if /dev/null is not available.
diff --git a/Lib/test/test_file2k.py b/Lib/test/test_file2k.py
index 5b90852..7e74e64 100644
--- a/Lib/test/test_file2k.py
+++ b/Lib/test/test_file2k.py
@@ -418,10 +418,16 @@
@unittest.skipUnless(os.name == 'posix', 'test requires a posix system.')
def test_write_full(self):
# Issue #17976
- with open('/dev/full', 'w', 1) as f:
+ try:
+ f = open('/dev/full', 'w', 1)
+ except IOError:
+ self.skipTest("requires '/dev/full'")
+ try:
with self.assertRaises(IOError):
f.write('hello')
f.write('\n')
+ finally:
+ f.close()
class FileSubclassTests(unittest.TestCase):