diff options
author | Коренберг Марк <socketpair@gmail.com> | 2017-08-14 13:55:16 (GMT) |
---|---|---|
committer | larryhastings <larry@hastings.org> | 2017-08-14 13:55:16 (GMT) |
commit | d4b93e21c2664d6a78e0656e7a7be0807be1c352 (patch) | |
tree | 3297bc642116c0d5dba018c00a67123b380c4d48 /Lib | |
parent | 48d9823a0ebde4dfab8bc154bb6df462fb2ee403 (diff) | |
download | cpython-d4b93e21c2664d6a78e0656e7a7be0807be1c352.zip cpython-d4b93e21c2664d6a78e0656e7a7be0807be1c352.tar.gz cpython-d4b93e21c2664d6a78e0656e7a7be0807be1c352.tar.bz2 |
bpo-31106: Fix handling of erros in posix_fallocate() and posix_fadvise() (#3000) (#3000)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_posix.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 148c064..dba50e0 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -298,6 +298,16 @@ class PosixTester(unittest.TestCase): finally: os.close(fd) + # issue31106 - posix_fallocate() does not set error in errno. + @unittest.skipUnless(hasattr(posix, 'posix_fallocate'), + "test needs posix.posix_fallocate()") + def test_posix_fallocate_errno(self): + try: + posix.posix_fallocate(-42, 0, 10) + except OSError as inst: + if inst.errno != errno.EBADF: + raise + @unittest.skipUnless(hasattr(posix, 'posix_fadvise'), "test needs posix.posix_fadvise()") def test_posix_fadvise(self): @@ -307,6 +317,15 @@ class PosixTester(unittest.TestCase): finally: os.close(fd) + @unittest.skipUnless(hasattr(posix, 'posix_fadvise'), + "test needs posix.posix_fadvise()") + def test_posix_fadvise_errno(self): + try: + posix.posix_fadvise(-42, 0, 0, posix.POSIX_FADV_WILLNEED) + except OSError as inst: + if inst.errno != errno.EBADF: + raise + @unittest.skipUnless(os.utime in os.supports_fd, "test needs fd support in os.utime") def test_utime_with_fd(self): now = time.time() |