Skip to content
Merged
Changes from 1 commit
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
Next Next commit
test: The red check and the push gate give the runner only files the …
…tests commit leaves in place

The tests come first and fail until the implementation.

The unit `di-repo-tidy/1` failed its red check three times with "nothing failed at the tests commit".

Unit: red-check-skips-deleted-test-files/1
  • Loading branch information
bwmatson committed Nov 17, 2026
commit 2ee7aa24245cc7b76a1fa3fb33970d8f3ececf55
56 changes: 56 additions & 0 deletions tests/pipeline/test_red_check_runnable_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,62 @@ def test_a_tests_commit_with_only_a_data_file_builds_no_red_command(repo: Path)
assert red_problems(repo, git(repo, "rev-parse", "HEAD~1"), profile=profile.toolchain) == []


def test_a_deleted_test_file_is_not_named_in_the_narrowed_run_or_the_run_of_the_files_whole(
repo: Path,
) -> None:
git(repo, "rm", "-q", "tests/test_old.py")
commit(repo, "test: moves one", {"tests/test_new.py": FAILING})
profile = Recording(PYTHON)

red_problems(repo, git(repo, "rev-parse", "HEAD"), profile=profile.toolchain)

(command,) = profile.commands
assert "test_old" not in command, "neither run names the deleted file"
words = shlex.split(command)
assert "tests/test_new.py::test_new" in words, "the narrowed run"
assert "tests/test_new.py" in words, "the run of the files whole"
assert profile.files == [["tests/test_new.py"]]


def test_the_push_gate_does_not_give_the_runner_a_deleted_test_file(repo: Path) -> None:
git(repo, "rm", "-q", "tests/test_old.py")
commit(repo, "test: moves one", {"tests/test_new.py": FAILING})
commit(repo, "feat: implements it", {"src/new.py": "x = 1\n"})
profile = Recording(PYTHON)

problems = check_branch(repo, "main", profile=profile.toolchain)

assert problems == []
assert profile.files == [["tests/test_new.py"]]


def test_a_renamed_test_file_runs_under_its_new_path_only(repo: Path) -> None:
git(repo, "mv", "tests/test_old.py", "tests/test_renamed.py")
commit(repo, "test: renames one", {"tests/test_renamed.py": FAILING})
profile = Recording(PYTHON)

red_problems(repo, git(repo, "rev-parse", "HEAD"), profile=profile.toolchain)

assert profile.files == [["tests/test_renamed.py"]]
assert "test_old" not in profile.commands[0]


def test_a_tests_commit_that_only_deletes_a_test_file_is_a_tests_commit_with_no_red_command(
repo: Path,
) -> None:
git(repo, "rm", "-q", "tests/test_old.py")
commit(repo, "test: removes one", {})
commit(repo, "feat: code", {"src/thing.py": "x = 1\n"})
profile = Recording(PYTHON)

problems = check_branch(repo, "main", profile=profile.toolchain)

assert problems == [], "the deletion counts as the tests commit that precedes the code"
assert profile.commands == []
assert red_problems(repo, git(repo, "rev-parse", "HEAD~1"), profile=profile.toolchain) == []
assert profile.commands == []


@pytest.mark.parametrize(
("path", "runnable"),
[
Expand Down