Answer stability round 2: 0 🔴, 1 🟡 (0 misread); a test of the last poll, early returns in pushed, a plainer gh row match
This commit is contained in:
@@ -379,11 +379,15 @@ def pushed(run: Run, config: Config, sleep: typing.Callable[[float], None]) -> s
|
||||
if isinstance(sent, Failure):
|
||||
return sent
|
||||
comment = review_comment(run, config)
|
||||
number = None if comment is None or isinstance(comment, Failure) else shown_pull(forge, branch, head, run, sleep)
|
||||
if isinstance(comment, Failure):
|
||||
return Failure(f"pushed {branch}, but could not ask for a review: {comment.reason}")
|
||||
if isinstance(number, Failure) or number is None or comment is None:
|
||||
return number if isinstance(number, Failure) else f"Pushed {branch}."
|
||||
if comment is None:
|
||||
return f"Pushed {branch}."
|
||||
number = shown_pull(forge, branch, head, run, sleep)
|
||||
if number is None:
|
||||
return f"Pushed {branch}."
|
||||
if isinstance(number, Failure):
|
||||
return number
|
||||
made = comment_on(forge, number, comment, run)
|
||||
return Failure(f"pushed {branch}, but could not ask for a review: {made.reason}") if isinstance(made, Failure) else f"Pushed {branch}, and asked for a review of pull request #{number} with “{comment}”."
|
||||
|
||||
|
||||
@@ -1232,6 +1232,12 @@ class EpicBranch(unittest.TestCase):
|
||||
self.assertEqual(sum(slept), 60)
|
||||
self.assertNotIn(self.COMMENT_GH, checkout.ran)
|
||||
|
||||
def test_push_asks_for_a_review_where_the_forge_shows_the_new_head_at_the_last_poll(self):
|
||||
checkout, slept = self.checkout(), []
|
||||
checkout.listed_heads = [OLD] * 24 + [HEAD]
|
||||
self.assertIn("asked for a review of pull request #12", str(step(["push"], checkout, checkout.config, sleep=slept.append)))
|
||||
self.assertEqual(sum(slept), 60)
|
||||
|
||||
def test_push_does_not_wait_where_the_pull_request_goes_into_the_default_branch(self):
|
||||
checkout, slept = self.checkout(), []
|
||||
checkout.chunk_base = ""
|
||||
|
||||
Reference in New Issue
Block a user