style: repo-wide lint pass — make the lint gate green again
Push builds have been RED on the lint step since ~build 209 from accumulated formatting drift. This is the mechanical cleanup: ruff format + ruff --fix (UP038 isinstance unions, SIM105 contextlib.suppress, UP031 f-strings, SIM115 tempfile context manager), shfmt -i 2 -ci, nixpkgs-fmt/statix/deadnix (merged attrsets, dropped unused lib args), yamllint, and shell quoting fixes in tests/lasuite-docs/setup_custom_tests.sh. No behaviour changes intended; lint: PASS, unit tests: 138 passed.
This commit is contained in:
@ -29,9 +29,9 @@ def test_quick_form():
|
||||
|
||||
def test_non_trigger_forms_rejected():
|
||||
for body in (
|
||||
"!testmexyz", # the Adversary's classic negative
|
||||
"!testmexyz", # the Adversary's classic negative
|
||||
"!testme xyz",
|
||||
"!testme--quick", # no space → not the quick form
|
||||
"!testme--quick", # no space → not the quick form
|
||||
"!testme --quick", # double space → not an exact match (conservative)
|
||||
"please !testme",
|
||||
"testme",
|
||||
@ -43,10 +43,11 @@ def test_non_trigger_forms_rejected():
|
||||
|
||||
# --- Phase 3 U3: YunoHost-style PR comment builders (R2) -----------------------------------------
|
||||
|
||||
|
||||
def test_start_comment_is_yunohost_shaped():
|
||||
b = bridge.start_comment_body("uptime-kuma", "dfed87a39f8a", "https://drone.x/cc-ci/42")
|
||||
assert bridge.COMMENT_MARKER in b # re-!testme updates the same comment
|
||||
assert "🌻" in b and "⏳" in b # marker + in-progress
|
||||
assert bridge.COMMENT_MARKER in b # re-!testme updates the same comment
|
||||
assert "🌻" in b and "⏳" in b # marker + in-progress
|
||||
assert "uptime-kuma" in b and "dfed87a3" in b
|
||||
assert "https://drone.x/cc-ci/42" in b
|
||||
|
||||
@ -54,30 +55,38 @@ def test_start_comment_is_yunohost_shaped():
|
||||
def test_result_comment_image_forward_when_card_available(monkeypatch):
|
||||
monkeypatch.setattr(bridge, "artifact_available", lambda url: True)
|
||||
monkeypatch.setattr(bridge, "DASH_URL", "https://ci.example")
|
||||
b = bridge.result_comment_body("uptime-kuma", "dfed87a39f8a", "42", "https://drone.x/cc-ci/42", "success")
|
||||
b = bridge.result_comment_body(
|
||||
"uptime-kuma", "dfed87a39f8a", "42", "https://drone.x/cc-ci/42", "success"
|
||||
)
|
||||
assert bridge.COMMENT_MARKER in b
|
||||
assert "✅" in b and "passed" in b
|
||||
# the card + badge are embedded as linked images at the stable /runs/<num>/ URLs
|
||||
assert "" in b
|
||||
assert "https://ci.example/runs/42/badge.svg" in b
|
||||
assert "(https://drone.x/cc-ci/42)" in b # links to the run
|
||||
assert "(https://drone.x/cc-ci/42)" in b # links to the run
|
||||
|
||||
|
||||
def test_result_comment_text_fallback_when_card_missing(monkeypatch):
|
||||
# Render failed / not served → MUST degrade to text, never a broken image (R7).
|
||||
monkeypatch.setattr(bridge, "artifact_available", lambda url: False)
|
||||
b = bridge.result_comment_body("hedgedoc", "abc1234def", "9", "https://drone.x/cc-ci/9", "failure")
|
||||
assert "summary.png" not in b # no image embed
|
||||
assert "![" not in b # no markdown image at all
|
||||
b = bridge.result_comment_body(
|
||||
"hedgedoc", "abc1234def", "9", "https://drone.x/cc-ci/9", "failure"
|
||||
)
|
||||
assert "summary.png" not in b # no image embed
|
||||
assert "![" not in b # no markdown image at all
|
||||
assert "❌" in b and "failure" in b
|
||||
assert "https://drone.x/cc-ci/9" in b
|
||||
|
||||
|
||||
def test_find_existing_comment_matches_marker(monkeypatch):
|
||||
monkeypatch.setattr(bridge, "list_comments", lambda fn, n: [
|
||||
{"id": 1, "body": "just a normal comment"},
|
||||
{"id": 2, "body": bridge.COMMENT_MARKER + "\n🌻 old run"},
|
||||
])
|
||||
monkeypatch.setattr(
|
||||
bridge,
|
||||
"list_comments",
|
||||
lambda fn, n: [
|
||||
{"id": 1, "body": "just a normal comment"},
|
||||
{"id": 2, "body": bridge.COMMENT_MARKER + "\n🌻 old run"},
|
||||
],
|
||||
)
|
||||
assert bridge.find_existing_comment("org/repo", 5) == 2
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user