Make GPU tests safe to collect on CPU-only hosts - #98
Conversation
|
Independently reproduced this on a CPU-only host (macOS, Python 3.13, no CUDA/NPU/XPU). The approach is right and I think this should land. Notes below, including one thing I don't think has been said yet about why the current behavior on The status quo doesn't just fail loudly — it silently collects meaningless tests
But So the three And collection succeeding is not the same as the suite passing. On current With this PR rebased on All six failures become clean skips with an actionable reason ( The branch is 4 commits stale, and the raw numbers look alarming because of itWorth flagging so the diff isn't misread. This branch forks from I rebased it locally onto
So the newer XPU and device-manager tests added since the fork point coexist with the autouse fixture without issue. A rebase and a refreshed set of numbers in the description is all this needs. The fixture generalizes beyond the files touchedNice property that isn't called out in the description: Moving parametrize construction to runtime is the right call
Replacing Optional nitThe fixture catches only SummaryVerified the fix, verified it rebases clean onto current |
Summary
Root cause
GPU/NPU test modules initialized
DeviceManagerand evaluated device counts during module import and parameter collection. On CPU-only hosts, this could fail before pytest applied the-m "not gpu"filter.Validation
pytest -v -m "not gpu" tests— 55 passed, 1 skipped, 6 deselectedpytest -q tests— 55 passed, 7 skippedruff check .ruff format --check .Closes #95