- templates/bot_runner.py (new, no Qt): runs the bot as a child process (unbuffered, UTF-8), tails its output, keeps raw lines in bot_raw.log, and turns lines into step/log/status events. Step markers and friendly rules use specific substrings, first match wins; unmatched error lines are always shown, other unmatched lines hidden. Dry run: python dashboard/bot_runner.py prints the events the page would get. - bridge.py: delegates to bot_runner, one run at a time, restores the saved dark mode on every page load (fixes sample-data mode in PyQt), adds load_latest_report / download_report slots the page calls. - SKILL.md: skip the stack question for a PyQt project; desktop wiring steps from the bot's real output; verify steps for the host. - tests: assert-based self-check for the line logic and run loop; Seam 1 run replay (status dot, Run button, steps, log) and wired-page mode; fixture b-pyqt-bot and its Seam 2 eval (all 14 checks pass). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
"""Python templates must stay valid Python before their placeholders are filled."""
|
|
import shutil
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
HOOK_RULES = "E9,F63,F7,F82,F811" # same rule set as the PostToolUse lint hook
|
|
|
|
|
|
@pytest.mark.parametrize("template", ["rpa-dashboard-no-ai/templates/bridge.py",
|
|
"rpa-dashboard-no-ai/templates/bot_runner.py"])
|
|
def test_template_passes_lint_hook_unfilled(template):
|
|
ruff = shutil.which("ruff") or pytest.skip("ruff not on PATH")
|
|
r = subprocess.run([ruff, "check", "--select", HOOK_RULES, "--no-cache", str(ROOT / template)],
|
|
capture_output=True, text=True)
|
|
assert r.returncode == 0, r.stdout
|
|
|
|
|
|
def test_tebra_sky_preset_is_the_template_default():
|
|
templates = ROOT / "rpa-dashboard-no-ai" / "templates"
|
|
themes = (templates / "themes.md").read_text(encoding="utf-8")
|
|
sky = themes.split("## 1. Tebra Sky")[1].split("```css\n")[1].split("```")[0]
|
|
assert sky in (templates / "dashboard.html").read_text(encoding="utf-8")
|