mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-04 20:02:05 +00:00
Pick a test interpreter that can import pytest, not just one named python
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) <[email protected]> Claude-Session: https://claude.ai/code/session_01Vtx94nXDmNgXEeThUZP4QN
This commit is contained in:
1 parent
4503b7eee4
commit
98816c4b70
1 file changed
+19
-3
+19
-3
@@ -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
|
||||
|
||||
Reference in new issue
Block a user