Skip to content

Add missing unit test coverage for GitCLI.list_worktrees and GitCLI.delete_branch #83

Description

@bjester

Observed Behavior

Commit 21941c3 added GitCLI.list_worktrees(), GitCLI.delete_branch(), and GitCLI.get_branch_head(). While get_branch_head was provided with a unit test in tests/test_git.py, neither list_worktrees nor delete_branch have any unit tests. The porcelain parsing logic in list_worktrees (parsing worktree , branch , bare) is completely untested by direct unit tests.

Expected Behavior

All public methods on GitCLI should have comprehensive unit tests covering regular operation, flags, and edge cases in accordance with the project testing standards.

Steps to Reproduce

  1. Inspect tests/test_git.py:124-136.
  2. Notice test_get_branch_head exists, but there are no tests for list_worktrees or delete_branch.

Minimal Reproduction Environment / Conditions

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

Deliverables & Testing Requirements

  • Add test_list_worktrees in tests/test_git.py testing:
    • Standard linked worktrees with branch refs (refs/heads/...)
    • Detached HEAD worktrees (branch is None)
    • Bare repository entries (is_bare is True)
  • Add test_delete_branch in tests/test_git.py testing:
    • force=False passes -d
    • force=True passes -D
  • Regression Safety: All tests must execute cleanly under pytest.

Technical Pointers & Root Cause Clues

  • Suspected Components: src/treefort/git.py:73-90, tests/test_git.py
  • Related Commits: 21941c3 (Add list_worktrees, delete_branch, and get_branch_head GIT helpers)

Notes & Edge Cases

  • Test naming and structure should adhere to .aiassistant/rules/tests.md.

Metadata

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

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