From 98816c4b706a2469475d9bfdbbfca17c50006e3a Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN Date: Thu, 20 Aug 2026 09:50:44 -0400 Subject: [PATCH] Pick a test interpreter that can import pytest, not just one named python MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With Windows finally installing its dependencies, the CI build job reached the test step for the first time and died on "msys64/mingw64/bin/python.exe: No module named pytest". The MSYS2 toolchain is prepended to PATH so native wheels can build, and MSYS2 ships its own python.exe. run_ci_tests.sh took the first `python` on PATH, which was therefore MSYS2's. The determinism gate immediately before it had passed on the same runner because it invokes the `pytest` executable, which MSYS2 does not provide — so PATH resolution quietly sent the two scripts to different interpreters. Selection is now by capability rather than by name: try each candidate and keep the first that can actually import pytest, failing loudly with the resolved paths if none can. Unchanged on Linux and macOS, where the first `python` is the right one. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Vtx94nXDmNgXEeThUZP4QN --- scripts/run_ci_tests.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/scripts/run_ci_tests.sh b/scripts/run_ci_tests.sh index 0515e9b9..810800da 100755 --- a/scripts/run_ci_tests.sh +++ b/scripts/run_ci_tests.sh @@ -7,12 +7,28 @@ if [[ "${TUI2_SMOKE_GATE:-0}" == "1" ]]; then ./scripts/tui2_check_smoke.sh fi +# Pick an interpreter that can actually import pytest, not merely the first +# one named "python" on PATH. On Windows the MSYS2 toolchain is prepended to +# PATH so native wheels can build, and MSYS2 ships its own python.exe -- so a +# bare `python` resolved to that one and the whole suite died with "No module +# named pytest", after the determinism gate had already passed using the +# `pytest` executable, which MSYS2 does not provide. if [[ -x ".venv/bin/python" ]]; then py_bin=".venv/bin/python" -elif command -v python >/dev/null 2>&1; then - py_bin="python" else - py_bin="python3" + py_bin="" + for candidate in python python3; do + if command -v "$candidate" >/dev/null 2>&1 \ + && "$candidate" -c "import pytest" >/dev/null 2>&1; then + py_bin="$candidate" + break + fi + done + if [[ -z "$py_bin" ]]; then + echo "no interpreter on PATH can import pytest" >&2 + command -v python python3 >&2 || true + exit 1 + fi fi if [[ "${DETERMINISM_GATE:-1}" == "1" ]]; then