[Python-checkins] cpython: Cope with OSs lying - #10142: Support for SEEK_HOLE/SEEK_DATA
jesus.cea
python-checkins at python.org
Sat Jul 7 14:57:15 CEST 2012
http://hg.python.org/cpython/rev/d69f95e57792
changeset: 77969:d69f95e57792
user: Jesus Cea <jcea at jcea.es>
date: Sat Jul 07 14:56:04 2012 +0200
summary:
Cope with OSs lying - #10142: Support for SEEK_HOLE/SEEK_DATA
files:
Lib/test/test_posix.py | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1017,9 +1017,6 @@
@unittest.skipUnless(hasattr(os, 'SEEK_HOLE'),
"test needs an OS that reports file holes")
- @unittest.skipIf(sys.platform in ('freebsd7', 'freebsd8', 'freebsd9'),
- "Skip test because known kernel bug - " \
- "http://lists.freebsd.org/pipermail/freebsd-amd64/2012-January/014332.html")
def test_fs_holes(self):
# Even if the filesystem doesn't report holes,
# if the OS supports it the SEEK_* constants
@@ -1032,11 +1029,18 @@
fp.flush()
size = fp.tell()
fno = fp.fileno()
- for i in range(size):
- self.assertEqual(i, os.lseek(fno, i, os.SEEK_DATA))
- self.assertLessEqual(size, os.lseek(fno, i, os.SEEK_HOLE))
- self.assertRaises(OSError, os.lseek, fno, size, os.SEEK_DATA)
- self.assertRaises(OSError, os.lseek, fno, size, os.SEEK_HOLE)
+ try :
+ for i in range(size):
+ self.assertEqual(i, os.lseek(fno, i, os.SEEK_DATA))
+ self.assertLessEqual(size, os.lseek(fno, i, os.SEEK_HOLE))
+ self.assertRaises(OSError, os.lseek, fno, size, os.SEEK_DATA)
+ self.assertRaises(OSError, os.lseek, fno, size, os.SEEK_HOLE)
+ except OSError :
+ # Some OSs claim to support SEEK_HOLE/SEEK_DATA
+ # but it is not true.
+ # For instance:
+ # http://lists.freebsd.org/pipermail/freebsd-amd64/2012-January/014332.html
+ raise unittest.SkipTest("OSError raised!")
class PosixGroupsTester(unittest.TestCase):
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list