fix(tests): correct arg type to _terminate_then_kill at L213 (S5655) #63
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "Claude/backup-script:fix/issue-15-S5655-restic-test-arg-type-L213"
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 #15
Line 213 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.
Other call sites at lines 220, 228, 243 and 261 carry the same smell and
are addressed in PRs for #16, #17, #18 and #20 respectively. Each is a
distinct call site, so each gets its own one-line PR.
All 12 tests in the file still pass locally.
Line 213 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 #15View 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.