diff --git a/tests/test-apm-current-hook.sh b/tests/test-apm-current-hook.sh index 8408d9c..ca7c5c8 100755 --- a/tests/test-apm-current-hook.sh +++ b/tests/test-apm-current-hook.sh @@ -794,6 +794,8 @@ if ! command -v git > /dev/null 2>&1 \ echo " $SKIP_REASON" else PROBE="$(mktemp -d)" + UV_REAL_CACHE="${UV_CACHE_DIR:-$(uv cache dir 2> /dev/null || true)}" + UV_REAL_PYTHONS="${UV_PYTHON_INSTALL_DIR:-$(uv python dir 2> /dev/null || true)}" trap 'rm -rf "$FAKE_BIN" "$WORK" "$TOOLS" "$UV_BIN" "$PIN_BIN" "$PATH_APM_BIN" "$PINNED" "$PROBE"' EXIT UPSTREAM="$PROBE/upstream.git" @@ -837,9 +839,16 @@ else echo "deployments: []" } > "$PROBE/consumer/apm.lock.yaml" # env cannot run a shell function, so probe_apm is re-declared in a child bash. + # HOME moves to an empty dir, so uv's cache and its managed Pythons (both + # under HOME by default) are pinned to the real ones resolved before the + # move, and UV_OFFLINE forbids any fetch: the probe runs the already-synced + # pin and never needs the network. ( cd "$PROBE/consumer" && env HOME="$PROBE/home" \ + UV_CACHE_DIR="$UV_REAL_CACHE" \ + UV_PYTHON_INSTALL_DIR="$UV_REAL_PYTHONS" \ + UV_OFFLINE=1 \ GIT_CONFIG_GLOBAL="$PROBE/gitconfig" \ GIT_CONFIG_NOSYSTEM=1 \ GIT_TERMINAL_PROMPT=0 \