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
23 changes: 23 additions & 0 deletions .github/reviewer-bot-tests/test_reviewer_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest
import yaml

from builder import build_cli
from scripts import reviewer_bot
from scripts.reviewer_bot_lib import comment_routing, sweeper

Expand Down Expand Up @@ -984,6 +985,28 @@ def fake_run_command(command, cwd, check=False):
assert "--locked was provided" in message


def test_update_spec_lock_file_mode_exits_before_build_docs(monkeypatch, tmp_path):
monkeypatch.setattr(build_cli.argparse.ArgumentParser, "parse_args", lambda self: type("Args", (), {
"clear": False,
"offline": False,
"ignore_spec_lock_diff": False,
"update_spec_lock_file": True,
"validate_urls": False,
"serve": False,
"check_links": False,
"xml": False,
"verbose": False,
"debug": False,
})())
called = {"update": 0, "build": 0}
monkeypatch.setattr(build_cli, "update_spec_lockfile", lambda url, path: called.__setitem__("update", called["update"] + 1) or True)
monkeypatch.setattr(build_cli, "build_docs", lambda *args, **kwargs: called.__setitem__("build", called["build"] + 1))
with pytest.raises(SystemExit) as exc_info:
build_cli.main(tmp_path)
assert exc_info.value.code == 0
assert called == {"update": 1, "build": 0}


def test_observer_run_reason_mapping_and_near_miss_signature():
signature = {"status": "waiting", "conclusion": None, "name": "approval_pending"}
assert sweeper.observer_run_reason_from_details({"status": "waiting", "conclusion": None, "name": "approval_pending"}, signature) == "awaiting_observer_approval"
Expand Down
3 changes: 2 additions & 1 deletion builder/build_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ def main(root):
builder = "linkcheck" if args.check_links else "xml" if args.xml else "html"

if args.update_spec_lock_file:
update_spec_lockfile(SPEC_CHECKSUM_URL, root / "src" / SPEC_LOCKFILE)
success = update_spec_lockfile(SPEC_CHECKSUM_URL, root / "src" / SPEC_LOCKFILE)
raise SystemExit(0 if success else 1)

build_docs(
root,
Expand Down
Loading