app
KiCad - the KiCad Bridge
Public Made by Adomby adom
Drive your own KiCad from an AI, in the background: open every editor, read the whole board as data (the EDA Bridge Standard board model), stack-up, part heights, netlists, place, route, pour, DRC and exports.
master
import json, sys, tempfile, time, unittest
from pathlib import Path
from unittest.mock import patch
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from handlers import progress
class Recent(unittest.TestCase):
def test_recent_reports_outcome_newest_first(self):
with tempfile.TemporaryDirectory() as d:
with patch.object(progress, "_runlog_path", return_value=Path(d) / "runs.jsonl"), \
patch.object(progress, "_caller", return_value="thread A"), \
patch.object(progress, "record", lambda *a, **k: None):
progress.log_run("install_symbol", 63.8, ok=True)
progress.log_run("open_board", 2.0, ok=False, note="File not found: x.kicad_pcb", caller="thread B")
rows = progress.recent()
self.assertEqual([r["verb"] for r in rows], ["open_board", "install_symbol"])
self.assertEqual(rows[0]["error"], "File not found: x.kicad_pcb"); self.assertFalse(rows[0]["ok"])
self.assertIsNone(rows[1]["error"]); self.assertTrue(rows[1]["ok"]); self.assertEqual(rows[1]["caller"], "thread A")
self.assertEqual([r["verb"] for r in progress.recent(caller="thread A")], ["install_symbol"])
if __name__ == "__main__":
unittest.main()