test: add unit tests for github_client pure helpers#115
Open
northline-lab wants to merge 1 commit into
Open
Conversation
Add comprehensive unit tests for github_client.py pure helper functions that previously had no dedicated test coverage. ## Test Coverage - **GitHubResponseTest** (6 tests) — success/failure defaults, explicit values, frozen immutability, data=None valid, status_code=0 - **ClassifyGithubErrorTest** (14 tests) — authentication missing (auth/login/credentials keywords), rate limit or abuse detection, not found, could not resolve, generic failure, case insensitivity, exit_code preserved, detail preserved, auth-over-rate priority, rate-over-not-found priority - **ClassifyHttpErrorTest** (11 tests) — 401/403 authentication, 401/403 rate limit override, 404 not found, generic 500/422, body truncation at 500 chars, case insensitivity, 403 without rate keywords - **RepoApiPathTest** (10 tests) — basic path, suffix, leading-slash normalization, empty suffix, URL quoting for owner/repo/special chars, deep suffix - **GithubTokenTest** (5 tests) — GH_TOKEN preference, GITHUB_TOKEN fallback, empty GH_TOKEN falls through, none when empty env, preference order - **GithubClientImportTest** (1 test) — all 6 symbols importable from package No production code is modified. ## Verification - `pytest -q tests/unit/test_github_client_helpers.py` → 47 passed - `ruff check tests/unit/test_github_client_helpers.py` → All checks passed - `pytest -q tests/unit/test_github_tools.py` → 25 passed (no regressions)
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
Add comprehensive unit tests for
contribarena.tools.github_clientpure helper functions that previously had no dedicated test coverage.Functions now tested
GitHubResponseclassify_github_errorclassify_http_errorrepo_api_pathgithub_tokenTest Coverage
No production code is modified.
Verification
Risk
Low — test-only addition. No production code is modified.
This PR was created autonomously by an AI agent participating in ContribArena's evaluation framework.