Nightly tests: the scheduled refresh, the notes and the repo's reviewers list
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,25 @@
|
||||
import datetime as dt
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from tools.ci import nightly
|
||||
from tools.ci import nightly_set as ns
|
||||
|
||||
NOW = "2026-10-28T12:00:00+00:00"
|
||||
PATTERNS = ns.guarded_patterns((Path(__file__).resolve().parents[1] / ".github/CODEOWNERS").read_text())
|
||||
|
||||
|
||||
def pr(n, head="h", state="open", files=("crates/horizon-world/src/lib.rs",), base="main"):
|
||||
return ns.PullRequest(n, state, f"{head}{n}", f"Fix {n}", f"dev{n}", base, list(files))
|
||||
|
||||
|
||||
def lookup(*prs):
|
||||
known = {p.number: p for p in prs}
|
||||
return lambda n: known.get(n)
|
||||
|
||||
|
||||
def run(state, text, login="kacpherek", *prs):
|
||||
return ns.apply(state, ns.parse(text), login, NOW, lookup(*prs), PATTERNS)
|
||||
|
||||
T = dt.datetime(2026, 10, 28, 12, 0, tzinfo=dt.timezone.utc)
|
||||
|
||||
@@ -45,5 +63,25 @@ class NightlyTests(unittest.TestCase):
|
||||
self.assertIn("Everything in it is on main.", nightly.notes("2026-10-28", ref("main", "m" * 40, 0), []))
|
||||
|
||||
|
||||
|
||||
class ScheduledTests(unittest.TestCase):
|
||||
def test_the_scheduled_nightly_takes_new_heads_and_drops_closed_ones(self):
|
||||
state = run({}, "/nightly 1 2 3 4", "kacpherek", pr(1), pr(2), pr(3), pr(4)).state
|
||||
get = lookup(pr(1, head="new"), pr(2, state="merged"), pr(3, state="closed"),
|
||||
pr(4, files=[".github/workflows/x.yml"]))
|
||||
kept, left_out = nightly.refresh(state["prs"], get, PATTERNS)
|
||||
self.assertEqual([(e["number"], e["head"]) for e in kept], [(1, "new1")])
|
||||
self.assertEqual(len(left_out), 3)
|
||||
self.assertIn("merged", left_out[0])
|
||||
|
||||
def test_notes_list_each_pull_request_and_who_picked_it(self):
|
||||
prs = run({}, "/nightly 1 2", "kacpherek", pr(1), pr(2)).state["prs"]
|
||||
main = nightly.Ref("main", "m" * 40, None)
|
||||
text = nightly.set_notes("2026-10-28", nightly.Ref("nightly/build-2026-10-28-1", "b" * 40, None), main, prs,
|
||||
["#3 Fix 3: closed, left out"])
|
||||
self.assertIn("can include pull requests not reviewed yet, picked by trusted reviewers", text)
|
||||
self.assertIn("- Fix 1 (#1) by dev1, at h1, picked by kacpherek", text)
|
||||
self.assertIn("### Left out (1)", text)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -71,6 +71,11 @@ class AllowTests(unittest.TestCase):
|
||||
ns.authorize("kacpherek", reviewers)
|
||||
ns.authorize("ludovic111", reviewers)
|
||||
|
||||
def test_the_repos_list_names_the_three_reviewers(self):
|
||||
reviewers = ns.read_reviewers((ROOT / ns.REVIEWERS).read_text())
|
||||
self.assertEqual(reviewers.logins, {"kacpherek", "rdbtcvs", "levzzz5154"})
|
||||
self.assertFalse(reviewers.paused)
|
||||
|
||||
class RefusalTests(unittest.TestCase):
|
||||
def test_what_codeowners_guards_is_refused(self):
|
||||
for path in (".github/workflows/x.yml", "tools/ci/nightly.py", "crates/horizon-release-sign/src/lib.rs",
|
||||
|
||||
Reference in New Issue
Block a user