Skip to content

Commit cc98745

Browse files
cmaloneyclaude
andauthored
gh-161262: Fix test_touch_common flake on Emscripten (#161464)
Under Node, NODEFS takes a new file's mtime from the host kernel but utime(path, None) uses Date.now() written back via fs.utimesSync, which can land a millisecond before the creation time. Take the baseline from utime(path, None) too, so both timestamps come from the same source. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1ca9ef9 commit cc98745

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎Lib/test/test_pathlib/test_pathlib.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2332,6 +2332,9 @@ def test_touch_common(self):
23322332
self.assertFalse(p.exists())
23332333
p.touch()
23342334
self.assertTrue(p.exists())
2335+
# Take the baseline from utime(None) like touch() below; creation can
2336+
# use a different clock (Emscripten NODEFS).
2337+
os.utime(p, None)
23352338
st = p.stat()
23362339
old_mtime = st.st_mtime
23372340
old_mtime_ns = st.st_mtime_ns

0 commit comments

Comments
 (0)