Skip to content

test: cover _auto_classify_files timeout + invalid-element message#129

Merged
manager-identity[bot] merged 1 commit into
mainfrom
test/handoff-coverage-gaps
May 11, 2026
Merged

test: cover _auto_classify_files timeout + invalid-element message#129
manager-identity[bot] merged 1 commit into
mainfrom
test/handoff-coverage-gaps

Conversation

@manager-identity
Copy link
Copy Markdown
Contributor

Summary

  • Add test_auto_files_warns_on_git_timeout to cover the subprocess.TimeoutExpired branch in scripts/pt.py:_auto_classify_files() (4695-4701). The function emits "warning: git status timed out at 10s, ..." to stderr and returns []; this test pins that behaviour for --auto-files handoff creation. Pattern mirrors the existing test_auto_files_warns_on_git_missing / test_auto_files_warns_on_git_nonzero_exit.
  • Add assert "element 0" in payload["error"]["message"] to test_handoff_create_files_invalid_element_type for parity with the two sibling tests (test_handoff_create_files_missing_required_keys, test_handoff_create_files_unknown_classification) which both assert message content.

No production code changes.

Test plan

  • pytest tests/test_handoff_cli.py::test_auto_files_warns_on_git_timeout passes
  • pytest tests/test_handoff_cli.py::test_handoff_create_files_invalid_element_type passes with the new assertion
  • All 4 sibling tests (git_missing, git_nonzero_exit, missing_required_keys, unknown_classification) still pass
  • Local code-reviewer PASS verdict (correct monkeypatch target, assertion executes before any return)

Related

  • Closes #6156
  • Follow-up to #6151 (pt handoff command)

…sage (#6156)

Two test-coverage gaps in the pt handoff command (#6151 follow-up):

1. _auto_classify_files() in scripts/pt.py has tests for FileNotFoundError
   and non-zero-exit branches but no test for subprocess.TimeoutExpired.
   Add test_auto_files_warns_on_git_timeout that monkeypatches subprocess.run
   to raise TimeoutExpired and asserts the "timed out" warning appears in
   stderr with file_list == []. Mirrors the existing branch-test pattern.

2. test_handoff_create_files_invalid_element_type only checked exit code
   and error.class. Its two siblings (missing_required_keys and
   unknown_classification) both assert message content. Add the parallel
   assertion: "element 0" in payload["error"]["message"].

No production code changes.

Closes #6156.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@manager-identity manager-identity Bot merged commit 6a8959a into main May 11, 2026
2 checks passed
@manager-identity manager-identity Bot deleted the test/handoff-coverage-gaps branch May 11, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants