fix(tests): correct arg type to _terminate_then_kill at L261 (S5655) #70

Open
Claude wants to merge 1 commit from Claude/backup-script:fix/issue-20-S5655-restic-test-arg-type-L261 into master
First-time contributor

Closes #20

Line 261 of tests/unit/test_restic_engine_audit_fixes.py passed a bare
_FakeProc (a Popen-like duck type, not an actual subprocess.Popen) to
_terminate_then_kill, which expects a subprocess.Popen[Any]. The test
file was silencing this with # type: ignore[arg-type], but SonarQube
python:S5655 still flags it as a wrong-typed argument.

Wraps the call in typing.cast("subprocess.Popen[bytes]", proc) so the
type checker and Sonar both see the intended type at the call site, and
the ignore comment is no longer needed. Behaviour is unchanged — cast()
is a no-op at runtime.

Sibling PRs fix the same smell at lines 213 (#15), 220 (#16), 228 (#17)
and 243 (#18).

All 12 tests in the file still pass locally.

Closes #20 Line 261 of `tests/unit/test_restic_engine_audit_fixes.py` passed a bare `_FakeProc` (a Popen-like duck type, not an actual `subprocess.Popen`) to `_terminate_then_kill`, which expects a `subprocess.Popen[Any]`. The test file was silencing this with `# type: ignore[arg-type]`, but SonarQube python:S5655 still flags it as a wrong-typed argument. Wraps the call in `typing.cast("subprocess.Popen[bytes]", proc)` so the type checker and Sonar both see the intended type at the call site, and the ignore comment is no longer needed. Behaviour is unchanged — `cast()` is a no-op at runtime. Sibling PRs fix the same smell at lines 213 (#15), 220 (#16), 228 (#17) and 243 (#18). All 12 tests in the file still pass locally.
Line 261 passed a bare `_FakeProc` (a Popen-like duck type, not an
actual `subprocess.Popen`) to `_terminate_then_kill`, and silenced
the type error with `# type: ignore[arg-type]`. SonarQube
python:S5655 still flags this as a wrong-typed argument.

Wrap the call in `typing.cast("subprocess.Popen[bytes]", proc)` so
the type checker (and Sonar) see the intended type at the call site
and the ignore comment is no longer needed.

Closes #20
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u fix/issue-20-S5655-restic-test-arg-type-L261:Claude-fix/issue-20-S5655-restic-test-arg-type-L261
git switch Claude-fix/issue-20-S5655-restic-test-arg-type-L261

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff Claude-fix/issue-20-S5655-restic-test-arg-type-L261
git switch Claude-fix/issue-20-S5655-restic-test-arg-type-L261
git rebase master
git switch master
git merge --ff-only Claude-fix/issue-20-S5655-restic-test-arg-type-L261
git switch Claude-fix/issue-20-S5655-restic-test-arg-type-L261
git rebase master
git switch master
git merge --no-ff Claude-fix/issue-20-S5655-restic-test-arg-type-L261
git switch master
git merge --squash Claude-fix/issue-20-S5655-restic-test-arg-type-L261
git switch master
git merge --ff-only Claude-fix/issue-20-S5655-restic-test-arg-type-L261
git switch master
git merge Claude-fix/issue-20-S5655-restic-test-arg-type-L261
git push origin master
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bc1bb/backup-script!70
No description provided.