fix(tests): correct arg type to _terminate_then_kill at L228 (S5655) #65
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "Claude/backup-script:fix/issue-17-S5655-restic-test-arg-type-L228"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #17
Line 228 of
tests/unit/test_restic_engine_audit_fixes.pypassed a bare_FakeProc(a Popen-like duck type, not an actualsubprocess.Popen) to_terminate_then_kill, which expects asubprocess.Popen[Any]. The testfile was silencing this with
# type: ignore[arg-type], but SonarQubepython:S5655 still flags it as a wrong-typed argument.
Wraps the call in
typing.cast("subprocess.Popen[bytes]", proc)so thetype 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), 243 (#18)
and 261 (#20).
All 12 tests in the file still pass locally.
Line 228 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 #17View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.