Skip to content

Mutation testing: run() subprocess wrapper survivors #37

Description

@leynos

Context

Mutation-testing run against main (b850e2fec11b1966d2b73670ae56b5eff195284e), mutmut 3.6.0, local run 2026-07-10: 1025 mutants, 151 killed, 235 survived, 639 no-tests.

This issue covers the run() subprocess wrapper in hooks/post-turn-quality-stop-hook.py: 25 survivors (23 real gaps, 2 equivalent mutants handled in the worklist).

Surviving mutants

  • hooks/post-turn-quality-stop-hook.py:153subprocess.run keyword mutations: text=TrueNone/False/removed, capture_output=TrueNone/False/removed, check=FalseTrue (x_run__mutmut_3, 4, 8, 9, 12, 13, 14).
  • hooks/post-turn-quality-stop-hook.py:156Path(exc.filename or "")or "XXXX" in the FileNotFoundError guard (x_run__mutmut_17).
  • hooks/post-turn-quality-stop-hook.py:159 and :163 — fallback CompletedProcess field mutations in both the FileNotFoundError and NotADirectoryError branches: args=cmdNone/removed, returncode=12/None/removed, stdout="""XXXX"/None/removed, stderr=str(exc)None/str(None)/removed (x_run__mutmut_1940, 16 survivors).

Analysis

The only direct tests of run() cover the missing-cwd path and assert just returncode and a substring of stderr. No test invokes run() against a real command, so the text/capture_output keywords mutate freely; and no test exercises the NotADirectoryError branch or asserts args/stdout on the fallback objects, so those field mutations survive. Two mutants are equivalent (check=FalseNone, and dropping check=False) and are recorded as category 2 in the worklist rather than here.

Suggested tests

  1. Run run(["sh", "-c", "echo out; echo err >&2; exit 3"], tmp_path) and assert returncode == 3, stdout == "out\n", stderr == "err\n" as str (kills the text and capture_output mutants and check=True, which would raise).
  2. Exercise the NotADirectoryError branch (use a file path as cwd) and assert the full fallback object: args == cmd, returncode == 1, stdout == "", and stderr (kills the field mutants at line 163).
  3. Extend the existing missing-cwd test to assert result.args == cmd and result.stdout == "" (kills the field mutants at line 159).
  4. Low priority: patch subprocess.run to raise a filename-less FileNotFoundError with cwd=Path(".") and assert the fallback is returned rather than re-raised (kills x_run__mutmut_17).

Full worklist: triage worklist.md; dataset SHA b850e2f.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions