test(coverage): boost total coverage 65% → 71%#38
Merged
Conversation
added 2 commits
June 3, 2026 22:15
…uest tests v1.6.1에서 KISClient.make_request가 requests → httpx로 교체되었으나 (commit 52cb530) 테스트의 mock 타겟이 그대로 requests.request에 머물러 실제 httpx 호출이 발생, 인증 실패로 JSON_DECODE_ERROR가 반환되며 make_request 계열 테스트들이 의도와 다르게 통과/실패하던 문제 수정. 변경: - tests/unit/test_client.py: 6개 @patch("requests.request") → httpx.request. 토큰 갱신용 @patch("requests.post")는 client.py:480이 여전히 requests.post를 쓰므로 유지. - tests/unit/test_client_comprehensive.py: 7개 with patch("requests.request") → httpx.request. 결과: test_client.py 22 passed, test_client_comprehensive.py 36 passed (58/58).
…ts + 3 new test files
목표 70% 달성 + 1%p 안전 마진.
변경 내역:
1. kis_agent/responses/__init__.py
- futures.py(171줄) / overseas_futures.py(240줄) re-export 추가
- 두 모듈은 TypedDict 정의만 모인 타입 힌팅 전용으로, 다른
responses/*.py와 마찬가지로 __init__에서 import만 되면 100% 커버
- 결과: responses/futures.py 0% → 100%, responses/overseas_futures.py 0% → 100%
2. tests/unit/test_cli_schema.py (NEW, 9 tests)
- get_schema() 동작 커버: 전체 SDL 반환, 타입별 추출, unknown 타입
- cli/schema.py 6% → 97%
3. tests/unit/test_ws_event_manager.py (NEW, 13 tests)
- Observer 패턴 EventManager 동기/비동기 emit, 히스토리 capping,
리스너 등록/해제/초기화, 비동기 listener exception 처리 등 커버
- websocket/event_manager.py 37% → 100%
4. tests/unit/test_ws_connection.py (NEW, 19 tests)
- ConnectionManager의 connect/disconnect/send/recv/reconnect/is_alive/
get_stats 분기를 AsyncMock으로 커버. 재연결 시 지수 백오프 호출 검증
- websocket/connection.py 26% → 100%
전체: TOTAL 65% → 71% (statements 9592, missed 2824).
38개 신규 테스트 추가, 기존 테스트 영향 없음.
📊 Coverage Analysis Report
✅ All files meet the target coverage of 70%! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pytest 커버리지 총합을 65% → 71%로 끌어올림 (목표 70% + 1%p 마진).
본 PR은 #37의 `fix(test): mock httpx.request` 커밋을 cherry-pick으로 포함합니다 (cdbfd44). #37이 먼저 머지되면 자동으로 reconcile됩니다. 충돌 시 본 PR을 rebase하시면 됩니다.
Changes
Coverage delta
Test plan