summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-11-18 00:11:54 +0000
committerClaude <noreply@anthropic.com>2026-11-18 00:11:54 +0000
commit0a5c67674bfba7cf9e67f4b1bbb4464d881ccb91 (patch)
tree72a9b394c865905ee631902c9bb2400c3595b4fc /plugins
parentbdbd27da1d3b535eabfdf7dc5bf2e308858d7d3a (diff)
security-guidance: let a killed holder's lock be released late in a testmhegazy/sg-commit-diff-memory
Windows can release a killed process's file lock a moment after the process ended, so the wait that follows may see it held once more. Co-authored-by: mhegazy <mhegazy@anthropic.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/security-guidance/tests/test_chained_commit_push.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/security-guidance/tests/test_chained_commit_push.py b/plugins/security-guidance/tests/test_chained_commit_push.py
index 9b105362..1cbae3b4 100644
--- a/plugins/security-guidance/tests/test_chained_commit_push.py
+++ b/plugins/security-guidance/tests/test_chained_commit_push.py
@@ -262,10 +262,16 @@ def test_wait_for_holder_stops_at_the_limit(tmp_path):
assert diffstate.is_held(str(path)) is True
p.kill()
p.wait()
- assert diffstate.wait_for_holder(str(path), 20) == (True, 0.0)
+ # Windows can release a killed process's lock a moment after it ended.
+ ended, waited = diffstate.wait_for_holder(str(path), 20)
+ assert ended is True and waited < 5
finally:
p.kill()
p.communicate()
+ # A file nobody holds is no wait at all.
+ free = tmp_path / "free"
+ free.write_text("")
+ assert diffstate.wait_for_holder(str(free), 20) == (True, 0.0)
def test_both_reviews_pick_the_same_commits(repo):