Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip certain cugraph-pyg tests when torch-sparse is not available #3970

Merged
merged 4 commits into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions python/cugraph-pyg/cugraph_pyg/tests/test_cugraph_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@

torch = import_optional("torch")
torch_geometric = import_optional("torch_geometric")
torch_sparse = import_optional("torch_sparse")
trim_to_layer = import_optional("torch_geometric.utils.trim_to_layer")

try:
import torch_sparse # noqa: F401

HAS_TORCH_SPARSE = True
except: # noqa: E722
HAS_TORCH_SPARSE = False


@pytest.mark.skipif(isinstance(torch, MissingModule), reason="torch not available")
def test_cugraph_loader_basic(karate_gnn):
Expand Down Expand Up @@ -201,9 +207,7 @@ def test_cugraph_loader_from_disk_subset():


@pytest.mark.skipif(isinstance(torch, MissingModule), reason="torch not available")
@pytest.mark.skipif(
isinstance(torch_sparse, MissingModule), reason="torch-sparse not available"
)
@pytest.mark.skipif(not HAS_TORCH_SPARSE, reason="torch-sparse not available")
def test_cugraph_loader_from_disk_subset_csr():
m = [2, 9, 99, 82, 11, 13]
n = torch.arange(1, 1 + len(m), dtype=torch.int32)
Expand Down Expand Up @@ -336,9 +340,7 @@ def test_cugraph_loader_e2e_coo():


@pytest.mark.skipif(isinstance(torch, MissingModule), reason="torch not available")
@pytest.mark.skipif(
isinstance(torch_sparse, MissingModule), reason="torch-sparse not available"
)
@pytest.mark.skipif(not HAS_TORCH_SPARSE, reason="torch-sparse not available")
@pytest.mark.parametrize("framework", ["pyg", "cugraph-ops"])
def test_cugraph_loader_e2e_csc(framework):
m = [2, 9, 99, 82, 9, 3, 18, 1, 12]
Expand Down
Loading