summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-11-23 00:32:53 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-11-23 00:32:53 (GMT)
commitbb6694de85341a0312beba1f91a364b8880008de (patch)
treea3eece5cd85f6d66b740ad0f0657a3aca8115a15
parent74193af0cf153589bd45169b9123befc0404b320 (diff)
downloadcpython-bb6694de85341a0312beba1f91a364b8880008de.zip
cpython-bb6694de85341a0312beba1f91a364b8880008de.tar.gz
cpython-bb6694de85341a0312beba1f91a364b8880008de.tar.bz2
Try to fix issue #19715 (timestamp rounding inconsistencies under Windows?)
-rwxr-xr-xLib/test/test_pathlib.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index 2aa8af2..6663ffa 100755
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -1388,11 +1388,15 @@ class _BasePathTest(object):
# Rewind the mtime sufficiently far in the past to work around
# filesystem-specific timestamp granularity.
os.utime(str(p), (old_mtime - 10, old_mtime - 10))
- # The file mtime is refreshed by calling touch() again
+ # The file mtime should be refreshed by calling touch() again
p.touch()
st = p.stat()
- self.assertGreaterEqual(st.st_mtime_ns, old_mtime_ns)
- self.assertGreaterEqual(st.st_mtime, old_mtime)
+ # Issue #19715: there can be an inconsistency under Windows between
+ # the timestamp rounding when creating a file, and the timestamp
+ # rounding done when calling utime(). `delta` makes up for this.
+ delta = 1e-6 if os.name == 'nt' else 0
+ self.assertGreaterEqual(st.st_mtime, old_mtime - delta)
+ # Now with exist_ok=False
p = P / 'newfileB'
self.assertFalse(p.exists())
p.touch(mode=0o700, exist_ok=False)