def test__native_nccl_but_no_gpu(mock_gpu_is_not_available): env_backup = os.environ with pytest.raises(RuntimeError, match=r"Nccl backend is required but no cuda capable devices"): _NativeDistModel(backend="nccl") # environ could be corrupted by _NativeDistModel os.environ.clear() os.environ.update(env_backup)
def test__native_nccl_but_no_gpu(mock_gpu_is_not_available): with pytest.raises(RuntimeError, match=r"Nccl backend is required but no cuda capable devices"): _NativeDistModel(backend="nccl")