summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2012-07-07 12:56:04 (GMT)
committerJesus Cea <jcea@jcea.es>2012-07-07 12:56:04 (GMT)
commitd46f7d209b0d6db48f63c8317df9bfefbed73ae7 (patch)
treef6a6539e1580c7b452aef73a7511c66b369cfcfe /Lib
parentccd712a8d17d1d5ffe28ff85adc2f185b6678297 (diff)
downloadcpython-d46f7d209b0d6db48f63c8317df9bfefbed73ae7.zip
cpython-d46f7d209b0d6db48f63c8317df9bfefbed73ae7.tar.gz
cpython-d46f7d209b0d6db48f63c8317df9bfefbed73ae7.tar.bz2
Cope with OSs lying - #10142: Support for SEEK_HOLE/SEEK_DATA
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_posix.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 9bedc7d..f0ad92f 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1017,9 +1017,6 @@ class PosixTester(unittest.TestCase):
@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 @@ class PosixTester(unittest.TestCase):
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):