Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/features/interlock_stages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ Feature: interlocks stage commands on a minimal inline project
And the stage output contains "changed vs HEAD"
And the stage output contains "skipped under --changed"

# req: stage-check
Scenario: `interlocks check --changed` skips graph-wide gates and runs file-level gates
Given a minimal tmp project initialized as a git repo
And the tmp project has a changed Python file
When I run "interlocks check --changed=HEAD" in the tmp project
Then the stage exits 0
And the stage output contains "test: skipped under --changed"
And the stage output contains "deps: skipped under --changed"
And the stage output contains "attribution: skipped under --changed"
And the stage output contains "[fix]"
And the stage output contains "[format]"
And the stage output contains "[typecheck]"
Comment on lines +82 to +84

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

To fully verify the contract for file-level gates under the --changed flag, consider adding assertions for [format] and [crap]. These tasks are also scoped to changed files in the check stage and should appear in the output alongside [fix] and [typecheck].

    And the stage output contains "[fix]"
    And the stage output contains "[format]"
    And the stage output contains "[typecheck]"
    And the stage output contains "[crap]"

And the stage output contains "[crap]"

# req: stage-check
Scenario: `interlocks check --changed` honors changed_ref from pyproject
Given a minimal tmp project initialized as a git repo
Expand Down
6 changes: 5 additions & 1 deletion tests/step_defs/test_interlock_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ def _stage_exits(stage_result: subprocess.CompletedProcess[str], code: int) -> N
)


def _stage_combined(result: subprocess.CompletedProcess[str]) -> str:
return result.stdout + result.stderr
Comment on lines +141 to +142

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 PR description states that _stage_combined() was extracted to deduplicate logic shared by both output assertion steps. However, it is currently only used in _stage_output_contains. If the intention was to standardize output handling, consider also using it in _stage_exits (lines 134-138), although the current separate view in that function is admittedly better for debugging.



@then(parsers.parse('the stage output contains "{fragment}"'))
def _stage_output_contains(stage_result: subprocess.CompletedProcess[str], fragment: str) -> None:
combined = stage_result.stdout + stage_result.stderr
combined = _stage_combined(stage_result)
assert fragment in combined, f"expected {fragment!r} in stage output; got:\n{combined}"
Loading