[Python-checkins] r68621 - python/trunk/Lib/test/test_os.py

kristjan.jonsson python-checkins at python.org
Thu Jan 15 23:40:03 CET 2009


Author: kristjan.jonsson
Date: Thu Jan 15 23:40:03 2009
New Revision: 68621
Log:
Fix two test cases in test_os. ftruncate raises IOError unlike all the others which raise OSError. And close() on some platforms doesn't complain when given an invalid file descriptor.
Modified:
 python/trunk/Lib/test/test_os.py
Modified: python/trunk/Lib/test/test_os.py
==============================================================================
--- python/trunk/Lib/test/test_os.py	(original)
+++ python/trunk/Lib/test/test_os.py	Thu Jan 15 23:40:03 2009
@@ -534,8 +534,10 @@
 self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0)
 
 class TestInvalidFD(unittest.TestCase):
- singles = ["fchdir", "fdopen", "close", "dup", "fdatasync", "fstat",
+ singles = ["fchdir", "fdopen", "dup", "fdatasync", "fstat",
 "fstatvfs", "fsync", "tcgetpgrp", "ttyname"]
+ #singles.append("close")
+ #We omit close because it doesn'r raise an exception on some platforms
 def get_single(f):
 def helper(self):
 if getattr(os, f, None):
@@ -565,9 +567,10 @@
 if hasattr(os, "fpathconf"):
 self.assertRaises(OSError, os.fpathconf, 10, "PC_FILESIZEBITS")
 
+ #this is a weird one, it raises IOError unlike the others
 def test_ftruncate(self):
 if hasattr(os, "ftruncate"):
- self.assertRaises(OSError, os.ftruncate, 10, 0)
+ self.assertRaises(IOError, os.ftruncate, 10, 0)
 
 def test_lseek(self):
 self.assertRaises(OSError, os.lseek, 10, 0, 0)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /