[Python-checkins] cpython (2.7): Skip test for issue #17976 if /dev/null is not available.

serhiy.storchaka python-checkins at python.org
Tue Dec 17 13:54:18 CET 2013


http://hg.python.org/cpython/rev/237deaf9ba64
changeset:   88020:237deaf9ba64
branch:      2.7
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Dec 17 14:53:32 2013 +0200
summary:
  Skip test for issue #17976 if /dev/null is not available.

files:
  Lib/test/test_file2k.py |  8 +++++++-
  1 files changed, 7 insertions(+), 1 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
@@ -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):
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list