unsloth/tests
Daniel Han 47a6868261 Add comprehensive ROCm support test suite (68 tests)
Add tests/studio/install/test_rocm_support.py with 68 test cases
covering all ROCm-related code paths across install_llama_prebuilt.py,
install_python_stack.py, hardware.py, tokenizer_utils.py, and
install.sh. All tests use mocks and run without AMD hardware.

Test classes and coverage:

TestResolveUpstreamAssetChoice (11 tests):
  NVIDIA gets CPU asset, ROCm gets ROCm prebuilt, CPU gets CPU,
  macOS/Windows paths, NVIDIA+ROCm precedence, no prebuilt fallback,
  Windows+ROCm no HIP falls to CPU, macOS+ROCm, Linux aarch64+ROCm

TestRuntimePatterns (5 tests):
  Correct file globs for linux-cpu, linux-cuda, linux-rocm,
  windows-hip, macos-arm64

TestHostInfoRocm (4 tests):
  Default has_rocm=False, explicit True, NVIDIA host no ROCm,
  detect_host checks ROCM_PATH

TestDetectRocmVersion (9 tests):
  No ROCm returns None, version from file (7.1, 6.2), hipconfig
  fallback, empty version file, epoch prefix, multiple sources
  first wins, multiline hipconfig, hipconfig timeout

TestEnsureRocmTorch (9 tests):
  No ROCm skips, torch has CUDA skips, torch has HIP skips,
  CPU torch triggers reinstall, ROCm 6.3 correct tag, old ROCm
  skips, version unreadable warning, ROCm 7.2 capped to 7.1,
  probe timeout handled

TestRocmTorchIndex (8 tests):
  Mapping sorted descending, ROCm 7.2 not in map, key lookups,
  all tags use download.pytorch.org, newer ROCm selects best match

TestHardwareRocmFlag (8 tests):
  IS_ROCM defined, set on HIP, still returns CUDA for ROCm,
  no DeviceType.ROCM, IS_ROCM exported, in __all__,
  get_package_versions has rocm key

TestTokenizerErrorMessage (2 tests):
  No old "We do not support AMD" message, new message has docs link

TestInstallShStructure (10 tests):
  No <<< here-strings, ROCm detection present, CUDA precedence,
  bitsandbytes install, CPU hint mentions AMD, ROCm 7.2 capped,
  validation guard exists, dpkg epoch handling, no [[ ]] syntax,
  macOS returns CPU before ROCm

TestLiveRegression (1 test):
  Live nvidia-smi returns CUDA URL (skipped if no GPU)

Depends on #4714, #4715, #4716, #4717 being merged first.
2026-03-31 08:32:17 +00:00
..
python tests: add no-torch / Intel Mac test suite (#4646) 2026-03-27 02:33:45 -07:00
qlora Revert "[pre-commit.ci] auto fixes from pre-commit.com hooks" 2025-12-01 07:24:58 -08:00
saving Revert "[pre-commit.ci] auto fixes from pre-commit.com hooks" 2025-12-01 07:24:58 -08:00
sh tests: add no-torch / Intel Mac test suite (#4646) 2026-03-27 02:33:45 -07:00
studio/install Add comprehensive ROCm support test suite (68 tests) 2026-03-31 08:32:17 +00:00
utils feat: Implement Q-GaLore optimizer and custom embedding learning rate… (#4511) 2026-03-25 01:03:10 -07:00
__init__.py Qwen 3, Bug Fixes (#2445) 2025-04-30 22:38:39 -07:00
run_all.sh tests: add no-torch / Intel Mac test suite (#4646) 2026-03-27 02:33:45 -07:00
test_get_model_name.py Fixup mapper issues and resolve properly (#4124) 2026-03-03 06:57:25 -08:00
test_model_registry.py Revert "[FIX] Vllm guided decoding params (#3662)" 2025-12-01 05:43:45 -08:00
test_raw_text.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-01-08 11:35:21 +00:00