* Fix 14 stale tests under tests/studio/install/ that drifted from code
All 14 failures audited locally and tracked back to test-side drift
(no production-code regressions). After these test updates the entire
tests/studio/install/ directory now passes: 346 passed, 1 skipped.
Per failure:
tests/studio/install/test_install_llama_prebuilt_logic.py (5 fails):
* test_existing_install_matches_plan_with_fingerprint_linux
* test_install_prebuilt_skips_download_when_existing_install_matches
* test_install_prebuilt_skips_when_older_release_fallback_matches_existing_install
* test_install_prebuilt_skips_same_release_fallback_attempt_when_installed
* test_existing_install_matches_choice_fails_when_install_tree_incomplete
All five build a fake Linux install tree via write_linux_install_shape
and call existing_install_matches_choice. The matcher returns False
because runtime_payload_is_healthy now requires a libllama-common.so*
library in build/bin/ (added by PR #5135), and the fixture never wrote
it. Add the missing library to write_linux_install_shape; matcher
passes for all five tests.
tests/studio/install/test_rocm_support.py (8 fails after the partial
audit, one collection-tier flake):
* TestEnsureRocmTorch::test_cpu_torch_gets_rocm_reinstall and
TestEnsureRocmTorch::test_probe_timeout_triggers_reinstall
_ensure_rocm_torch was refactored to call pip_install for the
torch reinstall and pip_install_try (not pip_install) for the
follow-up bitsandbytes install. The tests still asserted
mock_pip.call_count == 2. Add a second @patch.object on
pip_install_try and split the assertions across the two mocks.
* TestInstallShStructure::test_cuda_precedence
Asserted file-position-of-string ordering: looked for
`if [ -z "$_smi" ]` before the first `amd-smi` literal in
install.sh. The installer now defines top-level helpers
`_has_amd_rocm_gpu` (uses `amd-smi`) and `_has_usable_nvidia_gpu`
(uses `nvidia-smi`) before either is called from
`get_torch_index_url`, so file-position ordering carries no
semantic meaning. Rewrite the test to extract the
`get_torch_index_url` body via a small brace-matched helper and
assert the runtime ordering: NVIDIA call sits before the
`if [ -z "$_smi" ]` branch and the AMD call sits inside it.
* TestLiveRegression::test_get_torch_index_url_returns_cuda_on_nvidia
Sed-extracted only get_torch_index_url and eval'd it -- but the
function calls _has_amd_rocm_gpu and _has_usable_nvidia_gpu, so
the eval'd body crashed and fell through to the CPU URL on a
fully-loaded NVIDIA host. Extract the helpers alongside the
function. Also pre-skip when nvidia-smi is on PATH but does not
list a GPU (containers occasionally ship the binary without a
driver).
* TestWorkerRocmMambaSsm::test_probe_script_has_getattr_hip and
TestWorkerRocmMambaSsm::test_probe_returns_hip_version_field
The wheel-resolver probe subprocess (the only place where
`getattr(torch.version, 'hip', None)` is emitted) was hoisted out
of worker.py into studio/backend/utils/wheel_utils.py during the
wheel-resolver refactor. Point the file-content assertions at
wheel_utils.py and assert worker.py still consumes the
`hip_version` field.
* TestHardwareAmdBranching::test_hardware_branches_on_is_rocm_for_utilization
TestHardwareAmdBranching::test_hardware_branches_on_is_rocm_for_visible
TestHardwareAmdBranching::test_hardware_branches_on_is_rocm_for_physical_count
hardware.py refactored: the IS_ROCM branch and direct
`from . import amd` were hoisted out of get_gpu_utilization /
get_visible_gpu_utilization into the shared `_smi_query`
dispatcher. Update the first two tests to assert the dispatcher
call shape (`_smi_query("get_primary_gpu_utilization", ...)` etc.)
plus IS_ROCM + amd-import in `_smi_query` itself. Update the
physical-count test to assert IS_ROCM + the literal `from . import
amd` as that function still imports amd directly rather than going
through `_smi_query`.
No production-code changes; tests-only.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>