Problem Description
In hardware.py, the --gpu auto flag runs subprocess.run(["rocm-smi", "--showmeminfo", "vram"]) to dynamically detect AMD GPUs. This path is currently completely untested because GitHub Actions runners don't have AMD GPUs.
Proposed Solution
- In
tests/test_hardware.py (you will need to create this file), use unittest.mock.patch to mock subprocess.run.
- Feed the mock a sample string output of what
rocm-smi --showmeminfo vram actually produces.
- Assert that
detect_local_gpu() correctly parses the string, identifies the GPU count, and returns the correct AMD VRAM in GB.
Alternatives Considered
None.
Additional Context
Requires Python mocking knowledge to simulate the system call, but adds immense value to the robustness of our AMD support.
Problem Description
In
hardware.py, the--gpu autoflag runssubprocess.run(["rocm-smi", "--showmeminfo", "vram"])to dynamically detect AMD GPUs. This path is currently completely untested because GitHub Actions runners don't have AMD GPUs.Proposed Solution
tests/test_hardware.py(you will need to create this file), useunittest.mock.patchto mocksubprocess.run.rocm-smi --showmeminfo vramactually produces.detect_local_gpu()correctly parses the string, identifies the GPU count, and returns the correct AMD VRAM in GB.Alternatives Considered
None.
Additional Context
Requires Python mocking knowledge to simulate the system call, but adds immense value to the robustness of our AMD support.