File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1388,11 +1388,15 @@ def test_touch_common(self):
13881388 # Rewind the mtime sufficiently far in the past to work around
13891389 # filesystem-specific timestamp granularity.
13901390 os .utime (str (p ), (old_mtime - 10 , old_mtime - 10 ))
1391- # The file mtime is refreshed by calling touch() again
1391+ # The file mtime should be refreshed by calling touch() again
13921392 p .touch ()
13931393 st = p .stat ()
1394- self .assertGreaterEqual (st .st_mtime_ns , old_mtime_ns )
1395- self .assertGreaterEqual (st .st_mtime , old_mtime )
1394+ # Issue #19715: there can be an inconsistency under Windows between
1395+ # the timestamp rounding when creating a file, and the timestamp
1396+ # rounding done when calling utime(). `delta` makes up for this.
1397+ delta = 1e-6 if os .name == 'nt' else 0
1398+ self .assertGreaterEqual (st .st_mtime , old_mtime - delta )
1399+ # Now with exist_ok=False
13961400 p = P / 'newfileB'
13971401 self .assertFalse (p .exists ())
13981402 p .touch (mode = 0o700 , exist_ok = False )
You can’t perform that action at this time.
0 commit comments