"""AirTst mode — V2 测试运行器。""" from pathlib import Path from air_runtime.test_runtime import TestRunner from air_runtime.io import safe_json_load from air_runtime.paths import airplan_root, event_log_path from air_runtime.events import EventLog, TEST_RUN def main(args) -> None: project_root = Path(args.project).expanduser().resolve() tid = args.task_id sub = args.sub or "status" if sub == "run" and args.framework: runner = TestRunner() result = runner.run(tid, project_root, args.framework) log = EventLog(event_log_path(project_root)) log.emit(TEST_RUN, { "taskId": tid, "framework": result.framework, "total": result.total, "passed": result.passed, "failed": result.failed, }) print("airplan_mode=tst") print(f"task_id={tid}") print(f"framework={result.framework}") print(f"total={result.total} passed={result.passed} failed={result.failed}") else: paths = airplan_root(project_root) / "state" / "airtst" state = safe_json_load(paths / "state.json") or {} print(f"airplan_mode=tst\nenabled={state.get('enabled', False)}")