Skip to content

Add missing unit test coverage for GithubCLI.merged_pr_by_head #84

Description

@bjester

Observed Behavior

GithubCLI.merged_pr_by_head() was introduced in src/treefort/gh.py to query merged PRs for branch pruning, but tests/test_gh.py only contains tests for pr_status and repo_status. merged_pr_by_head has zero unit test coverage.

Expected Behavior

GithubCLI.merged_pr_by_head() should have unit test coverage verifying command arguments, JSON parsing, --repo parameter inclusion, and exception handling.

Steps to Reproduce

  1. Inspect tests/test_gh.py.
  2. Observe only test_pr_status__calls_gh_and_parses_json, test_pr_status__with_owner_repo, and test_repo_status__calls_gh_and_parses_json are present.

Minimal Reproduction Environment / Conditions

  • Version / Branch / Commit: release-v0.5.x@6d07c0c
  • Component: tests/test_gh.py

Deliverables & Testing Requirements

  • Add unit tests in tests/test_gh.py for merged_pr_by_head:
    • Standard call with head ref name, verifying --head, --state merged, and --json arguments.
    • Call with owner_repo parameter, verifying --repo argument.
    • Error condition handling when self.run raises CalledProcessError.
  • Regression Safety: All tests must execute cleanly under pytest.

Technical Pointers & Root Cause Clues

  • Suspected Components: src/treefort/gh.py:43-65, tests/test_gh.py
  • Related Commits: 21941c3, bd7ed4c

Notes & Edge Cases

  • Conforms to .aiassistant/rules/tests.md naming conventions.

Metadata

Severity / Priority: P2 (Medium)
Area: testing, gh

AI Usage

Drafted with Gemini following the DEEP framework based on code review findings against release-v0.5.x. Reproduction conditions and code references were verified in the codebase.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    choremisc tasks

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions