Answer stability round 1: 1 🔴, 1 🟡 (0 misread); wait for a pull request at another head, and only where a review is owed

This commit is contained in:
2026-11-27 15:39:03 +01:00
parent 3b125bbcbd
commit c13f4cc154
4 changed files with 69 additions and 46 deletions
+9 -1
View File
@@ -9,7 +9,7 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from forge.pulls import BEHIND, CheckFailed, checks_now, checks_passed, CONFLICTS, open_pull, other_base, Pending, POLL_SECONDS, ready_pulls, ReadyPull, required_checks, unmergeable, WAIT_SECONDS
from forge.pulls import BEHIND, CheckFailed, checks_now, checks_passed, CONFLICTS, open_pull, other_base, Pending, POLL_SECONDS, pull_from, ready_pulls, ReadyPull, required_checks, unmergeable, WAIT_SECONDS
from failure import Failure
from forge.commands import forge_of, gitea, runner, url_beside
@@ -46,6 +46,14 @@ class Gitea(unittest.TestCase):
class OpenPull(unittest.TestCase):
def test_finds_the_open_pull_request_from_a_branch_whatever_its_head_is(self):
gh = "12\told\tfalse\n13\tfork\ttrue\n"
tea = json.dumps([{"number": 14, "head": {"label": "item-3", "sha": "old", "repo": {"full_name": "o/r"}}, "base": {"repo": {"full_name": "o/r"}}}, {"number": 15, "head": {"label": "item-3", "sha": "fork", "repo": {"full_name": "f/r"}}, "base": {"repo": {"full_name": "o/r"}}}])
self.assertEqual(pull_from("gh", "item-3", lambda command: gh), "12")
self.assertEqual(pull_from("tea", "item-3", lambda command: tea), "14")
self.assertEqual(open_pull("gh", "item-3", "new", lambda command: gh), None)
self.assertIsNone(pull_from("gh", "item-3", lambda command: "13\tfork\ttrue\n"))
def test_fails_quoting_the_first_200_characters_where_tea_lists_pull_requests_in_another_shape(self):
self.assertEqual(open_pull("tea", "item-3", "abc", lambda command: LONG).reason, f"tea api listed pull requests in a shape that can't be read: {LONG[:200]}")