]> granicus.if.org Git - python/commitdiff
Skip test for issue #17976 if /dev/null is not available.
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 17 Dec 2013 12:53:32 +0000 (14:53 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 17 Dec 2013 12:53:32 +0000 (14:53 +0200)
Lib/test/test_file2k.py

index 5b90852b070359fc8a5385ad268947580510ea78..7e74e64df644b5ce676e0f1de2347b01ca16f3c3 100644 (file)
@@ -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):