Summary
Module-level Device(0) initialization in numbast/src/numbast/experimental/mlir/tools/tests/test_symbol_exposure.py (lines 8–12) runs at pytest collection time, which blocks collection on machines without a CUDA runtime and prevents graceful skip behavior.
Details
# Current problematic code (lines 8-12)
from cuda.core.experimental import Device
dev = Device(0)
cc = dev.compute_capability
The codebase already uses fixture-based device queries elsewhere (e.g., conftest.py:arch_str() and test_shim_writer.py:cc()). The probe should be moved inside the test function (or a fixture), with a pytest.skip fallback if CUDA is unavailable.
Suggested fix
Move Device(0) into the test body and wrap with try/except:
def test_symbol_exposure(run_in_isolated_folder, arch_str):
try:
cc = Device(0).compute_capability
except Exception as e:
pytest.skip(f"CUDA device unavailable for symbol-exposure test: {e}")
...
Or alternatively, reuse the existing arch_str fixture (defined in conftest.py) which already derives the compute capability at test execution time.
References
Summary
Module-level
Device(0)initialization innumbast/src/numbast/experimental/mlir/tools/tests/test_symbol_exposure.py(lines 8–12) runs at pytest collection time, which blocks collection on machines without a CUDA runtime and prevents graceful skip behavior.Details
The codebase already uses fixture-based device queries elsewhere (e.g.,
conftest.py:arch_str()andtest_shim_writer.py:cc()). The probe should be moved inside the test function (or a fixture), with apytest.skipfallback if CUDA is unavailable.Suggested fix
Move
Device(0)into the test body and wrap withtry/except:Or alternatively, reuse the existing
arch_strfixture (defined inconftest.py) which already derives the compute capability at test execution time.References