Skip to content

Commit

Permalink
Round to int, because some systems support sub-second time stamps in …
Browse files Browse the repository at this point in the history
…stat, but not in utime.

Also be consistent with modifying only mtime, not atime.

git-svn-id: http://svn.python.org/projects/python/trunk@52341 6015fed2-1504-0410-9fe1-9d1591cc4771
  • Loading branch information
martin.v.loewis committed Oct 15, 2006
1 parent e20d1f2 commit 61908ee
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ def test_statvfs_attributes(self):
def test_utime_dir(self):
delta = 1000000
st = os.stat(test_support.TESTFN)
os.utime(test_support.TESTFN, (st.st_atime, st.st_mtime-delta))
# round to int, because some systems may support sub-second
# time stamps in stat, but not in utime.
os.utime(test_support.TESTFN, (st.st_atime, int(st.st_mtime-delta)))
st2 = os.stat(test_support.TESTFN)
self.assertAlmostEquals(st2.st_mtime, st.st_mtime-delta, 2)
self.assertEquals(st2.st_mtime, int(st.st_mtime-delta))

# Restrict test to Win32, since there is no guarantee other
# systems support centiseconds
Expand Down

0 comments on commit 61908ee

Please sign in to comment.