[Python-checkins] cpython: Issue #13964: Test also os.futimesat()

victor.stinner python-checkins at python.org
Wed Feb 8 03:06:56 CET 2012


http://hg.python.org/cpython/rev/c6e9c4d18b36
changeset: 74825:c6e9c4d18b36
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Wed Feb 08 03:07:25 2012 +0100
summary:
 Issue #13964: Test also os.futimesat()
files:
 Lib/test/test_os.py | 9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -307,7 +307,7 @@
 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 @@
 (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:
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /