Commit f4c31f1
committed
t4080: do not let an absent python interpreter abort the test
The PYTHON prereq introduced in dcb7920 ("diff: add long-running
diff process via diff.<driver>.process") is set whenever Git was
built without `NO_PYTHON`, which says nothing about whether a
`python3` or `python` binary is actually on `PATH` at test time.
On Bash 5+ the test suite runs under implicit `set -e`, so when both
`command -v` lookups fail the resulting non-zero exit kills the
entire script before the first `test_expect_success` even runs;
prove then reports the test as `Tests: 0 Failed: 0` with no useful
TAP output and the job ends in `FATAL: Unexpected exit with code 1`.
This is exactly what happens on Git for Windows' `win test (9)`
shard: Git for Windows is built with `NO_PYTHON` unset (the Perl
component drags in the Python bindings, so the conditional in
`Makefile` evaluates to keep Python support enabled), but the
runtime `PATH` only carries `python` under MSYS2 in some shards and
neither in others. The same hazard exists on any environment that
builds with Python support but does not install a Python
interpreter alongside.
Add a third fallback that explicitly clears `PYTHON_PATH`. The
assignment chain then always exits 0, so `set -e` is happy, and the
later tests that actually need Python continue to be guarded by the
`PYTHON` prereq (which they already use via `test_expect_success
PYTHON ...`). When `PYTHON_PATH` is empty, those tests still skip
cleanly via the prereq check.
This fix targets the in-flight upstream topic; once that topic and
this fixup are both in upstream, the next merging-rebase will
collapse this commit naturally.
Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>1 parent ac66243 commit f4c31f1
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
0 commit comments