summaryrefslogtreecommitdiff
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2012-02-08 03:07:25 +0100
committerVictor Stinner <victor.stinner@haypocalc.com>2012-02-08 03:07:25 +0100
commit8b6f10dda2bb096d9ded2943c2a5894a75830078 (patch)
tree87b5b0ad2f81b793b38bf31fc3004f47d5e26530 /Lib/test/test_os.py
parentbe557dedf9fdf724c786aa030c3b9af4400d7a43 (diff)
downloadcpython-git-8b6f10dda2bb096d9ded2943c2a5894a75830078.tar.gz
Issue #13964: Test also os.futimesat()
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 7d8712a999..a591f4bfcd 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -307,7 +307,7 @@ class StatAttributeTests(unittest.TestCase):
mtime = msec + mmsec * 1e-3
filename = self.fname
dirname = os.path.dirname(filename)
- for func in ('utime', 'futimes', 'futimens', 'lutimes', 'utimensat'):
+ for func in ('utime', 'futimes', 'futimens', 'futimesat', 'lutimes', 'utimensat'):
if not hasattr(os, func):
continue
os.utime(filename, (0, 0))
@@ -324,6 +324,13 @@ class StatAttributeTests(unittest.TestCase):
(msec, mmsec * 1000000))
elif func == 'lutimes':
os.lutimes(filename, (atime, mtime))
+ elif func == 'futimesat':
+ dirfd = os.open(dirname, os.O_RDONLY)
+ try:
+ os.futimesat(dirfd, os.path.basename(filename),
+ (atime, mtime))
+ finally:
+ os.close(dirfd)
else:
dirfd = os.open(dirname, os.O_RDONLY)
try: