Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/release/label_advice.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def declare(slug, n, value):


def owed(slug, author):
"""[{line, pr, title, why, command}] for author's merged PRs that a live line still owes (needs origin fetched)."""
"""[{line, pr, title, why, command}] for author's merged PRs that a live line still owes, from local origin refs: main() fetches them first."""
login = author or _gh("api", "user", "--jq", ".login")
rows = []
for branch, ref in sorted(rs._branches(".").items()):
Expand Down
24 changes: 24 additions & 0 deletions .github/release/test_label_advice.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,30 @@ def test_backports_run_log_shows_only_under_actions(self):
self.assertEqual(out.getvalue(), "")
self.assertEqual("held: 26 main commit(s)" in err.getvalue(), shown, env)

def test_the_cli_fetches_origin_before_reading_it(self):
dev_git(
self.repo, "update-ref", "-d", "refs/remotes/origin/release/1.7"
) # a stale clone
held = mock.Mock(return_value=[])
old = os.getcwd()
os.chdir(self.repo)
try:
with (
mock.patch.object(
la, "slug_from_origin", return_value="o/unstract-cloud"
),
mock.patch.object(bp, "held", held),
mock.patch.object(bp, "pr_classes", return_value={}),
mock.patch.object(bp, "declared", return_value=[]),
mock.patch.object(la, "_gh", return_value=json.dumps([{"number": 11}])),
mock.patch("sys.stdout"),
):
self.assertEqual(la.main(["--owed", "--author", "dev"]), 0)
finally:
os.chdir(old)
held.assert_called_once()
self.assertEqual(held.call_args.args[2], "release/1.7")

def test_backports_warnings_show_even_when_it_fails(self):
def fail(*a, **k):
print("::warning::PR listing failed, classing commit by commit: HTTP 403")
Expand Down
Loading