Skip to content

test(pins): prove [tool.interlocks.tools] overrides flow into every pinned-tool task cmd#56

Open
0xjgv wants to merge 1 commit into
mainfrom
unit3-tool-pin-probes
Open

test(pins): prove [tool.interlocks.tools] overrides flow into every pinned-tool task cmd#56
0xjgv wants to merge 1 commit into
mainfrom
unit3-tool-pin-probes

Conversation

@0xjgv

@0xjgv 0xjgv commented May 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds one pin-propagation test per pinned external tool (ruff, basedpyright, pip-audit, deptry, lizard, import-linter, interlocks-mutmut, coverage)
  • Each test sets [tool.interlocks.tools] in a temp pyproject.toml, calls the relevant task builder or config helper, and asserts the overridden version spec (<package>==9.99.0) appears in the resulting uvx / uv-run-with argv
  • No production code changes — tests confirmed no drift in any of the 8 tasks

Test plan

  • uv run pytest -q tests/test_config.py tests/test_runner.py tests/tasks/ → 316 passed
  • uv run interlocks check --changed → all gates green
  • Pre-commit hook ran clean on commit (ruff + pyright)

…inned-tool task command

Adds one focused pin-propagation test per pinned external tool — ruff,
basedpyright, pip-audit, deptry, lizard, import-linter, interlocks-mutmut,
and coverage — each verifying that a [tool.interlocks.tools] override in
pyproject.toml reaches the uvx / uv-run-with argv built by the corresponding
task or config helper.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a suite of tests to verify that tool version overrides specified in pyproject.toml under [tool.interlocks.tools] are correctly propagated to the command-line arguments for various tasks, including arch, audit, complexity, deps, lint, mutation, and typecheck. Feedback was provided to improve the robustness of the mutation test by calling the target function through its module object when internal functions are monkeypatched.

Comment on lines +624 to +627
monkeypatch.setattr(mutation_mod, "_run_mutmut", _spy_run)
monkeypatch.setattr(mutation_mod, "coverage_line_rate", lambda: 1.0)
monkeypatch.setattr(mutation_mod, "read_mutation_summary", lambda: None)
monkeypatch.setattr(sys, "argv", ["interlocks", "mutation", "--min-coverage=0"])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The test mocks several attributes on mutation_mod (which is interlocks.tasks.mutation) but then calls cmd_mutation() which was imported directly at line 27. While Python's module system ensures that cmd_mutation will see the mocked globals because it resides in that module, it is generally safer and more explicit to call the function through the module object when you are monkeypatching that same module's internal functions (like _run_mutmut or coverage_line_rate).

Suggested change
monkeypatch.setattr(mutation_mod, "_run_mutmut", _spy_run)
monkeypatch.setattr(mutation_mod, "coverage_line_rate", lambda: 1.0)
monkeypatch.setattr(mutation_mod, "read_mutation_summary", lambda: None)
monkeypatch.setattr(sys, "argv", ["interlocks", "mutation", "--min-coverage=0"])
monkeypatch.setattr(mutation_mod, "_run_mutmut", _spy_run)
monkeypatch.setattr(mutation_mod, "coverage_line_rate", lambda: 1.0)
monkeypatch.setattr(mutation_mod, "read_mutation_summary", lambda: None)
monkeypatch.setattr(sys, "argv", ["interlocks", "mutation", "--min-coverage=0"])
mutation_mod.cmd_mutation()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant