test(scratch): os.utime follow_symlinks is POSIX-only — guard it so the worktree test can age its tree on Windows too

This commit is contained in:
Sharpe authored and Teknium committed 2026-10-16 14:19:22 -07:00
1 parent 36bbacd0fa
commit fd74c42e54
1 file changed
+5 -1
+5 -1
View File
@@ -381,7 +381,11 @@ def test_prune_releases_git_worktree_registration_of_idle_entry(tmp_path):
ancient = time.time() - 30 * 3600
for dirpath, dirnames, filenames in os.walk(tree.parent):
for name in dirnames + filenames:
os.utime(os.path.join(dirpath, name), (ancient, ancient), follow_symlinks=False)
try:
os.utime(os.path.join(dirpath, name), (ancient, ancient), follow_symlinks=False)
except NotImplementedError:
# Windows: os.utime has no follow_symlinks parameter.
os.utime(os.path.join(dirpath, name), (ancient, ancient))
os.utime(tree.parent, (ancient, ancient))
assert prune_scratch_dir(scratch) == 1
listing = subprocess.run(["git", "worktree", "list", "--porcelain"], cwd=repo, capture_output=True,