Skip to content

tests/run.sh always passes the whole tests directory to pytest, so naming a test file in its arguments runs the whole suite, not the file #274

Open

Description

@brettheap

Found by lane openRepoTools-2's independent review of #228's pull request 3, now #268 (its verdict is #228's comment 6273189381: the bullet "The run.sh trap", and run b0). Lane openRepoTools-4 (#228, comment 6268952914) and lane 2's interim findings (comment 6268030648) had met the same thing. Lane 3 named the fix a v1.2.0 candidate on #228 (comment 6269261641): "Making run.sh honour a path is a v1.2.0 candidate, which lane 3 proposes to Brett Heap."

What happens

Where

  • tests/run.sh:342 and :348, on main 00d52ae: the two python3 -m pytest tests -q -p no:cacheprovider --basetemp="$RUN_ROOT/basetemp" ${1+"$@"} lines (the first runs the suite in the foreground when stdin is a terminal, the second in the background). :338 echoes the same line.
  • Pinned by: tests/test_run_wrapper.py:197 (rec["arg"][:5] == ["-m", "pytest", "tests", "-q", "-p"]), tests/test_repo_hygiene.py:4265 ("python3 -m pytest tests -q" in text), and AGENTS.md:266, which writes the form out.

How it was found

The fix

  • When an argument names a path under tests/, pass it in place of tests. Lane 4 put the same as "run.sh could stop adding tests when a path is given" (Releases: annotated tags, release/vX.Y branches, and openrepotools on TestPyPI and PyPI from v1.1.0 #228, comment 6268952914).
  • What a fix has to settle (nothing here is decided):
    • Which arguments count as naming a path. A node id such as tests/test_x.py::test_name does. A value that an option takes and that names a path under tests/ without selecting it, as pytest's --ignore and --deselect do, is not a selection.
    • The three places that pin the old form: tests/test_run_wrapper.py:197, tests/test_repo_hygiene.py:4265 and AGENTS.md:266. With no path given, the command must stay as they have it.
    • The test: tests/test_run_wrapper.py:187, test_a_run_relocates_bytecode_caches_and_temp_and_leaves_none_of_it, already runs the wrapper against a stub that records its argv. A case with a path argument fits beside it.

Why it is not in v1.1.0

Filed in milestone v1.2.0 on Brett Heap's word (2026-10-19T18:3xZ, "yes, file the v1.2.0 issues"). It is unclaimed.

Lane: openRepoTools-3

🤖 Generated with Claude Code

Activity

  1. added this to the v1.2.0 milestone on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions