Files
Pier_v1/Code/교각모델링앱/tools/run_all_tests.py
T
ahnyongjooandClaude Sonnet 5.5 964a841de1 chore(rebar): Pier_T_rebar 작업 폴더 초기 구성 및 외부 의존 파일 통합
- Code\rebar_pipeline, review_pipeline, pier-program을 정션에서 실제 폴더로 전환
- Code\rhino_mcp 및 CLAUDE_rhino배경.md 추가, .mcp.json은 PYTHONPATH로 새 위치 사용
- pier-program 내부 .git 제거(이력은 backup\pier-program_20261028.bundle에 보관)
- worktree 가이드 반영(CLAUDE.local.md, HANDOFF.md)
- D:\Rhino-MCP 경로 참조를 새 위치로 치환

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 11:20:18 +09:00

49 lines
2.7 KiB
Python

"""Run the app's test scripts one after another and summarise (2026-10-16).
usage: python run_all_tests.py <fast|rhino|all> [name ...]
fast = tests without Rhino; rhino = tests with real Rhino runs (one at a time, each can take several minutes).
Each test's output goes to 검증/_rerun_<name>_<date>.log; the summary (verdict, exit code, seconds, FAIL lines) to
검증/_rerun_summary_<group>_<date>.json. A test passes when its exit code is 0 and no line starts with 'FAIL'.
"""
import json
import subprocess
import sys
import time
from pathlib import Path
APP = Path(__file__).resolve().parents[1]
FAST = ["test_consistency", "test_geomread", "test_batch_notice", "test_review", "test_open19", "test_rampa", "test_saejae", "test_okseong", "test_confirm_required", "test_templates", "test_recommend",
"test_recommend_web", "test_ulsan_p2", "test_variability", "test_autocheck", "test_anchors", "test_delete_pier", "test_store_concurrency", "test_rampa_web"]
RHINO = ["test_web_batch", "test_pier_batch_button", "test_individual_after_batch", "test_web", "test_web_ulsan",
"test_web_ulsan_full", "test_ulsan_e2e"]
TIMEOUT = {"test_web": 2400, "test_web_ulsan": 1500, "test_web_ulsan_full": 2400, "test_ulsan_e2e": 3000, "test_web_batch": 2400}
def run(name, stamp):
log = APP / "검증" / f"_rerun_{name}_{stamp}.log"
t0 = time.time()
try:
r = subprocess.run([sys.executable, "-u", str(APP / "tools" / f"{name}.py")], cwd=str(APP), capture_output=True,
timeout=TIMEOUT.get(name, 900), env={**__import__("os").environ, "PYTHONIOENCODING": "utf-8"})
out, code = r.stdout.decode("utf-8", "replace") + r.stderr.decode("utf-8", "replace"), r.returncode
except subprocess.TimeoutExpired as e:
out, code = (e.stdout or b"").decode("utf-8", "replace") + "\nTIMEOUT", -9
log.write_text(out, encoding="utf-8")
fails = [ln[:240] for ln in out.splitlines() if ln.startswith("FAIL")]
return {"test": name, "ok": code == 0 and not fails, "exit": code, "secs": round(time.time() - t0), "fails": fails[:8],
"tail": out.strip().splitlines()[-1][:200] if out.strip() else ""}
if __name__ == "__main__":
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
group = sys.argv[1]
names = sys.argv[2:] or (FAST if group == "fast" else RHINO if group == "rhino" else FAST + RHINO)
stamp = time.strftime("%Y%m%d")
res = []
for n in names:
r = run(n, stamp)
res.append(r)
print(("PASS" if r["ok"] else "FAIL"), n, r["secs"], "s", r["tail"], flush=True)
(APP / "검증" / f"_rerun_summary_{group}_{stamp}.json").write_text(json.dumps(res, ensure_ascii=False, indent=1), encoding="utf-8")
print("DONE", sum(r["ok"] for r in res), "/", len(res))