mirror of https://github.com/python/cpython
Issue #13964: Test also os.futimesat()
This commit is contained in:
parent
be557dedf9
commit
8b6f10dda2
|
@ -307,7 +307,7 @@ class StatAttributeTests(unittest.TestCase):
|
||||||
mtime = msec + mmsec * 1e-3
|
mtime = msec + mmsec * 1e-3
|
||||||
filename = self.fname
|
filename = self.fname
|
||||||
dirname = os.path.dirname(filename)
|
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):
|
if not hasattr(os, func):
|
||||||
continue
|
continue
|
||||||
os.utime(filename, (0, 0))
|
os.utime(filename, (0, 0))
|
||||||
|
@ -324,6 +324,13 @@ class StatAttributeTests(unittest.TestCase):
|
||||||
(msec, mmsec * 1000000))
|
(msec, mmsec * 1000000))
|
||||||
elif func == 'lutimes':
|
elif func == 'lutimes':
|
||||||
os.lutimes(filename, (atime, mtime))
|
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:
|
else:
|
||||||
dirfd = os.open(dirname, os.O_RDONLY)
|
dirfd = os.open(dirname, os.O_RDONLY)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue