"""CPU test suite: hide the GPUs unless GPU tests were asked for (-m gpu). The GPUs run queued jobs, and some PyTorch paths (AdamW's graph-capture check) touch CUDA even for CPU tensors.""" import os def pytest_configure(config): markexpr = config.getoption("-m") or "" if "gpu" in markexpr and "not gpu" not in markexpr: return os.environ["CUDA_VISIBLE_DEVICES"] = ""