Fix #13327. utimensat now has the atime and mtime arguments set as optional,

defaulting to None like the other utimes family members. It now accepts
keyword arguments because, unlike other other functions in the family,
it has a `flags` value at the end of the argument list (which
retains its 0 default).
This commit is contained in:
Brian Curtin 2011-11-07 16:09:20 -06:00
parent 7ef53ef916
commit 569b494320
3 changed files with 21 additions and 11 deletions

View file

@ -815,11 +815,16 @@ class PosixTester(unittest.TestCase):
try:
now = time.time()
posix.utimensat(f, support.TESTFN, None, None)
posix.utimensat(f, support.TESTFN)
posix.utimensat(f, support.TESTFN, flags=os.AT_SYMLINK_NOFOLLOW)
self.assertRaises(TypeError, posix.utimensat, f, support.TESTFN, (None, None), (None, None))
self.assertRaises(TypeError, posix.utimensat, f, support.TESTFN, (now, 0), None)
self.assertRaises(TypeError, posix.utimensat, f, support.TESTFN, None, (now, 0))
posix.utimensat(f, support.TESTFN, (int(now), int((now - int(now)) * 1e9)),
(int(now), int((now - int(now)) * 1e9)))
posix.utimensat(dirfd=f, path=support.TESTFN,
atime=(int(now), int((now - int(now)) * 1e9)),
mtime=(int(now), int((now - int(now)) * 1e9)))
finally:
posix.close(f)