Repository navigation
Commit 4cbef41
authored
Run a pull request's touched nightly test modules in CI (#340)
The everyday suite `ci` runs on a pull request deselects every
nightly-marked module, so a pull request whose whole diff is one of
those modules goes green having exercised none of it. That is how #336
landed a rewrite of `tests/test_render_margin.py` and
`tests/test_render_anchors.py` under a green gate and reddened `main`
the moment it merged — #339 is the repair — and #338 is in the same
position right now with `tests/test_render_margin.py` and
`tests/test_render_navigation.py`.
This names the touched modules back. A new pull-request step diffs the
merge commit against its base parent, collects the `tests/test_*.py`
files the diff touches, and runs them with `-m nightly`: `conftest.py`
already runs what an explicit file selection names, `-m nightly` leaves
a mixed module's everyday cases to the step above rather than running
them twice, and pytest's exit 5 is what a pull request that touches no
nightly case gets. The cost is the touched files, not the 22–41 minute
nightly suite, and a pull request that touches no test module pays
nothing. A change to the runtime those modules drive is still the
nightly run's to catch; this reaches the modules themselves.
<details><summary>Verification</summary>
The step's shell was run locally against real commit ranges, with `uv
run pytest` swapped for the same invocation:
- `83f69563..d10463f` (#339's two nightly modules) — selects both, 155
nightly cases collected.
- `ff580ecb..867c526` (touches `tests/test_render_mcp.py`, which
carries no nightly mark) — selects it, `no tests ran`, exit 5 tolerated,
step exits 0.
- An empty range — `No test module touched.`, exit 0.
- `d10463fd..83f6956` (the same diff reversed, so the range reads as
deletions) — the `[ -f ]` filter drops what is not on disk and the step
still selects correctly.
End-to-end, `uv run pytest tests/test_render_drawing.py -m nightly -q`
is 21 passed, so the invocation drives real browser cases rather than
only collecting them.
Suite and lint on this branch:
- `uv run pytest tests` — 891 passed, 6 skipped.
- `uv run pytest tests/test_interact_layer.py` — 157 passed, 6 skipped
(this is the module that reads `ci.yaml`; the new step declares no
`working-directory`, so the gate-naming test is unaffected).
- `pre-commit run --files .github/workflows/ci.yaml CLAUDE.md
tests/CLAUDE.md` — passed, including actionlint's shellcheck pass over
the new `run:` block.
`fetch-depth: 2` on the `test` job's checkout is what gives the merge
commit its base parent; the default depth of 1 has no `HEAD^1` to diff
against.
</details>
Co-authored-by: leaf-agent <[email protected]>1 parent ac3342a commit 4cbef41
3 files changed
Lines changed: 38 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| |||
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
41 | 71 | | |
42 | 72 | | |
43 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
188 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| |||
0 commit comments