Fix test_posix if RWF_HIPRI is defined but not preadv2. (GH-13980)

If preadv2 is not available, preadv will raise NotImplementedError.
(cherry picked from commit 44867bb937)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
This commit is contained in:
Miss Islington (bot) 2019-06-11 10:33:36 -07:00 committed by GitHub
parent fad89046e1
commit 22e8a6d013
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -308,6 +308,8 @@ class PosixTester(unittest.TestCase):
buf = [bytearray(i) for i in [5, 3, 2]] buf = [bytearray(i) for i in [5, 3, 2]]
self.assertEqual(posix.preadv(fd, buf, 3, os.RWF_HIPRI), 10) self.assertEqual(posix.preadv(fd, buf, 3, os.RWF_HIPRI), 10)
self.assertEqual([b't1tt2', b't3t', b'5t'], list(buf)) self.assertEqual([b't1tt2', b't3t', b'5t'], list(buf))
except NotImplementedError:
self.skipTest("preadv2 not available")
except OSError as inst: except OSError as inst:
# Is possible that the macro RWF_HIPRI was defined at compilation time # Is possible that the macro RWF_HIPRI was defined at compilation time
# but the option is not supported by the kernel or the runtime libc shared # but the option is not supported by the kernel or the runtime libc shared