https://github.com/python/cpython/commit/cc987451e8e902ddc0db77485faa34973b4e3ca8
commit: cc987451e8e902ddc0db77485faa34973b4e3ca8
branch: main
author: Cody Maloney <[email protected]>
committer: cmaloney <[email protected]>
date: 2026-11-14T14:13:57-08:00
summary:

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 <[email protected]>

files:
M Lib/test/test_pathlib/test_pathlib.py

diff --git a/Lib/test/test_pathlib/test_pathlib.py 
b/Lib/test/test_pathlib/test_pathlib.py
index 788547c49e43e3..10e3ad6d92daec 100644
--- a/Lib/test/test_pathlib/test_pathlib.py
+++ b/Lib/test/test_pathlib/test_pathlib.py
@@ -2332,6 +2332,9 @@ def test_touch_common(self):
         self.assertFalse(p.exists())
         p.touch()
         self.assertTrue(p.exists())
+        # Take the baseline from utime(None) like touch() below; creation can
+        # use a different clock (Emscripten NODEFS).
+        os.utime(p, None)
         st = p.stat()
         old_mtime = st.st_mtime
         old_mtime_ns = st.st_mtime_ns

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to