test: let the interop suites find a Python that actually has h5py
Every Python interop suite had stopped running on this machine: the h5py writer round-trips, the facade suite, netCDF4 and the reference files. `python3` is 3.14, nothing on the box has h5py, and PEP 668 refuses to install it into a system interpreter at all — so the availability probes all returned false and each suite skipped without failing. A silent skip here is exactly how the v5 compound-datatype bug reached a release, so the probes now read `CLAWHDF5_PYTHON` and `ci-test.sh` picks up `.venv/bin/python` on its own. The detection sits at the top of the script rather than beside the interop step, because the non-ignored suites run in the earlier `cargo test` step and would otherwise still miss it. `CLAWHDF5_REQUIRE_INTEROP=1` continues to turn a skip into a failure. Verified against a venv with h5py 3.16 / HDF5 2.0.0: 94 interop tests across the four suites, all passing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
+15
-2
@@ -20,6 +20,13 @@
|
||||
set -uo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
# Interop suites drive a Python interpreter. On a PEP 668 "externally managed"
|
||||
# system h5py can only live in a virtualenv, so pick one up here — before any
|
||||
# test step, since the non-ignored interop suites read the same variable.
|
||||
if [ -z "${CLAWHDF5_PYTHON:-}" ] && [ -x "$SCRIPT_DIR/../.venv/bin/python" ]; then
|
||||
export CLAWHDF5_PYTHON="$SCRIPT_DIR/../.venv/bin/python"
|
||||
fi
|
||||
PASS=0
|
||||
FAIL=0
|
||||
STEPS=()
|
||||
@@ -85,12 +92,18 @@ run_step "cargo test (ann parallel)" cargo test \
|
||||
|
||||
# 5. Python interop suites. The h5py writer tests are #[ignore]d so a plain
|
||||
# `cargo test` stays hermetic; run them explicitly here.
|
||||
if python3 -c "import h5py" >/dev/null 2>&1 || [ "${CLAWHDF5_REQUIRE_INTEROP:-0}" = "1" ]; then
|
||||
# On a PEP 668 "externally managed" system h5py can only live in a
|
||||
# virtualenv, so honour CLAWHDF5_PYTHON (and a local .venv) rather than
|
||||
# skipping — the tests read the same variable.
|
||||
PYTHON="${CLAWHDF5_PYTHON:-python3}"
|
||||
if "$PYTHON" -c "import h5py" >/dev/null 2>&1 || [ "${CLAWHDF5_REQUIRE_INTEROP:-0}" = "1" ]; then
|
||||
run_step "h5py interop (format, ignored tests)" cargo test \
|
||||
-p clawhdf5-format --test writer_h5py_tests -- --include-ignored
|
||||
else
|
||||
echo ""
|
||||
echo "==> [h5py interop] SKIPPED: python3 with h5py not available"
|
||||
echo "==> [h5py interop] SKIPPED: no h5py in $PYTHON"
|
||||
echo " (set CLAWHDF5_PYTHON=/path/to/venv/bin/python, or create .venv;"
|
||||
echo " CLAWHDF5_REQUIRE_INTEROP=1 makes this a failure instead)"
|
||||
STEPS+=("SKIP: h5py interop (format, ignored tests)")
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user