pytest + httpx TestClient 인프라 도입 (TDD 정착) #18
Labels
No labels
api
bug
chore
collector
decision-needed
docs
enhancement
feature
feedback-loop
frontend
infra
skill
test
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
xhh/financial-data-platform#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sprint 2 본격 기능 추가 전, 회귀 방지 기반을 먼저 놓는다. 이후 모든 신규 엔드포인트는 테스트 동반 작성 (TDD) 을 관례화.
작업 범위
디렉토리 구조
tests/conftest.py— 공용 fixtureapi/— 엔드포인트 테스트 (test_watchlist.py,test_prices.py, ...)collectors/— 수집기 유닛 테스트 (OpenBB fallback 등)storage/— 모델 제약 테스트 (UniqueConstraint 등)conftest 주요 fixture
test_db: SQLite in-memory DB + create_all (세션별 격리)client: FastAPI TestClient + 위 DB 바인딩 + API_AUTH_DISABLED=1 주입seeded_watchlist: AMD/TSLA/FCX 시드된 상태로 시작의존성
httpx는 dev 그룹에 이미 있음pytest-asyncio추가 (FastAPI async 라우터 대비)실행
uv run pytest가 표준 명령CI 연동
.forgejo/workflows/에test.yml신설uv run pytest로 격리 실행 (uv sync 재사용)완료 기준
uv run pytest가 로컬에서 돌아가고 최소 하나의 smoke test (GET /api/health 200) 통과의존 없음. 다른 Sprint 2 이슈보다 먼저 완료 권고.