summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-11-09 22:55:50 +0000
committerClaude <noreply@anthropic.com>2026-11-09 22:55:50 +0000
commit93ce9ec8aa053ecdbb2e7689dceda428938cb914 (patch)
tree63d6434b5c3ea1fd4895b53f788127bf9b5a305d /plugins
parentfdc0d3f667456218b8ce7bdb36eba72961af1d53 (diff)
security-guidance: test merges must stop on a real conflictmhegazy/sg-push-merge-base
Co-authored-by: mhegazy <mhegazy@anthropic.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/security-guidance/tests/test_push_merge_base.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/security-guidance/tests/test_push_merge_base.py b/plugins/security-guidance/tests/test_push_merge_base.py
index 3dd75c0b..3bb6ccb9 100644
--- a/plugins/security-guidance/tests/test_push_merge_base.py
+++ b/plugins/security-guidance/tests/test_push_merge_base.py
@@ -43,10 +43,11 @@ def _merge_forward(repo):
def _merge_with_conflict(repo, ref):
- """Start a merge expected to stop on a conflict. Without the test identity
- git refuses before it writes the merge message."""
- return subprocess.run(["git", "merge", "--no-ff", "--no-edit", ref], cwd=repo,
- capture_output=True, env={**os.environ, **GIT_ENV})
+ """Start a merge and check that it stopped on a conflict, not on some
+ other refusal: exit 1 with the merge still open."""
+ r = subprocess.run(["git", "merge", "--no-ff", "--no-edit", ref], cwd=repo,
+ capture_output=True, env={**os.environ, **GIT_ENV})
+ assert r.returncode == 1 and (repo / ".git" / "MERGE_HEAD").exists(), r.stderr
def _push_fwd(repo, remote, env):
@@ -85,7 +86,7 @@ def test_conflict_resolution_is_still_reviewed(tmp_path, hook_env, stub_api):
git(repo, "push", "-q", "origin", "release")
_record_reviewed(repo, fix, other)
git(repo, "switch", "-q", "-c", "fwd", "main")
- assert _merge_with_conflict(repo, "origin/release").returncode != 0
+ _merge_with_conflict(repo, "origin/release")
(repo / "app.py").write_text("a = resolved_by_hand\n")
git(repo, "add", "-A")
git(repo, "commit", "-q", "--no-edit")