From: Serhiy Storchaka Date: Tue, 17 Dec 2013 12:53:32 +0000 (+0200) Subject: Skip test for issue #17976 if /dev/null is not available. X-Git-Tag: v2.7.8~193 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=84e7e5f40e2972af725e7f57e53bb6bcf3931912;p=python 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 5b90852b07..7e74e64df6 100644 --- a/Lib/test/test_file2k.py +++ b/Lib/test/test_file2k.py @@ -418,10 +418,16 @@ class OtherFileTests(unittest.TestCase): @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):