]> granicus.if.org Git - python/commitdiff
Issue #12105: test_posix skips test_oscloexec() on Linux < 2.6.23
authorVictor Stinner <victor.stinner@haypocalc.com>
Mon, 23 May 2011 22:29:43 +0000 (00:29 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Mon, 23 May 2011 22:29:43 +0000 (00:29 +0200)
Lib/test/test_posix.py

index 07e6b082e6381da5201c0d92015644006e5d0295..9d9802bb7e4f797b7294d0a4abf65ec2fba2e2c5 100644 (file)
@@ -310,10 +310,13 @@ class PosixTester(unittest.TestCase):
 
     @unittest.skipUnless(hasattr(os, 'O_CLOEXEC'), "needs os.O_CLOEXEC")
     def test_oscloexec(self):
+        version = support.linux_version()
+        if sys.platform == 'linux2' and version < (2, 6, 23):
+            self.skipTest("Linux kernel 2.6.23 or higher required, "
+                          "not %s.%s.%s" % version)
         fd = os.open(support.TESTFN, os.O_RDONLY|os.O_CLOEXEC)
         self.addCleanup(os.close, fd)
-        self.assertTrue(fcntl.fcntl(fd, fcntl.F_GETFD) & fcntl.FD_CLOEXEC,
-                        'CLOEXEC flag not set (O_CLOEXEC=0x%x)' % os.O_CLOEXEC)
+        self.assertTrue(fcntl.fcntl(fd, fcntl.F_GETFD) & fcntl.FD_CLOEXEC)
 
     def test_osexlock(self):
         if hasattr(posix, "O_EXLOCK"):