Skip to content

Commit 44e3be0

Browse files
miss-islingtoncmaloneyclaude
authored
[3.14] gh-161262: Fix test_touch_common flake on Emscripten (GH-161464) (#162026)
gh-161262: Fix test_touch_common flake on Emscripten (GH-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. (cherry picked from commit cc98745) Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e84e5c6 commit 44e3be0

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
@@ -2341,6 +2341,9 @@ def test_touch_common(self):
23412341
self.assertFalse(p.exists())
23422342
p.touch()
23432343
self.assertTrue(p.exists())
2344+
# Take the baseline from utime(None) like touch() below; creation can
2345+
# use a different clock (Emscripten NODEFS).
2346+
os.utime(p, None)
23442347
st = p.stat()
23452348
old_mtime = st.st_mtime
23462349
old_mtime_ns = st.st_mtime_ns

0 commit comments

Comments
 (0)