fix(test): mock httpx.request instead of requests.request in make_request tests#37
Merged
Merged
Conversation
…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).
📊 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
v1.6.1에서 `KISClient.make_request`가 `requests` → `httpx`로 교체되었으나 (commit 52cb530), 테스트의 mock 타겟이 그대로 `requests.request`에 머물러 있었던 문제 수정.
Root cause
`client.py:297` `httpx.request(...)`를 호출하지만 테스트는 `@patch("requests.request")`로 mocking 중이어서 실제 httpx 호출이 일어남. 그 결과 인증 실패 → `JSON_DECODE_ERROR` 반환으로 `test_make_request_success` 등이 항상 실패하던 상태.
Changes
Test plan