test: E2E 테스트 스크립트 추가 (분류/Foreman/NC 전모듈)

This commit is contained in:
2026-03-18 21:28:45 +09:00
parent 77bd211bce
commit 489755ff22

64
_test_foreman.py Normal file
View File

@@ -0,0 +1,64 @@
"""Foreman 목표 분해 로컬 테스트."""
import asyncio
import io
import sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
sys.path.insert(0, ".")
from core.foreman import Foreman, ForemanSession
async def main():
foreman = Foreman()
# 세션 생성 (가짜 thread/user id)
session = foreman.create_session(
goal="개인 블로그 만들기",
thread_id=99999,
user_id=11111,
)
print(f"[1] 세션 생성: id={session.id}, goal={session.goal}")
# 목표 분해
print("[2] 목표 분해 중...")
try:
result = await foreman.decompose_goal(session)
print(f"[2] 분해 결과 ({len(result)}자):")
print(result[:500])
except Exception as e:
print(f"[2] 분해 실패: {e}")
return
# 현황 확인
print("\n[3] 현황:")
status = foreman._show_status(session)
print(status[:500])
# 태스크 수
total = 0
for t in session.tasks:
total += len(t.to_flat_list())
print(f"\n[4] 총 태스크: {total}")
# 자유형식 대화 (수정 요청)
print("\n[5] 수정 요청: '프론트는 Next.js로 해줘'...")
try:
freeform_result = await foreman.handle_freeform(session, "프론트는 Next.js로 해줘")
print(f"[5] 수정 결과 ({len(freeform_result)}자):")
print(freeform_result[:500])
except Exception as e:
print(f"[5] 수정 실패: {e}")
# 확정 (Vikunja 등록은 스킵 — 실제 등록은 Discord에서)
print("\n[6] 확정 (Vikunja 등록 시도)...")
try:
confirm_result = await foreman.handle_command(session, "확정", "")
print(f"[6] 확정 결과: {confirm_result[:300]}")
except Exception as e:
print(f"[6] 확정 실패: {e}")
print("\n=== 테스트 완료 ===")
asyncio.run(main())