diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-10-15 11:02:07 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-10-15 11:02:07 (GMT) |
commit | a97e06d9dbf6b4a9774d386c11410f84476b83e2 (patch) | |
tree | 783eeed7dd43b722800ce1d70440346528ca20ac /Lib/test/test_os.py | |
parent | 012bc7253be3c8a04b9478e19157373810b8124b (diff) | |
download | cpython-a97e06d9dbf6b4a9774d386c11410f84476b83e2.zip cpython-a97e06d9dbf6b4a9774d386c11410f84476b83e2.tar.gz cpython-a97e06d9dbf6b4a9774d386c11410f84476b83e2.tar.bz2 |
Round to int, because some systems support sub-second time stamps in stat, but not in utime.
Also be consistent with modifying only mtime, not atime.
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r-- | Lib/test/test_os.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index cf5f1d6..9dcdb18 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -226,9 +226,11 @@ class StatAttributeTests(unittest.TestCase): 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 |