Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 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
38 changes: 38 additions & 0 deletions cuda_bindings/tests/helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

import os
import pathlib
import sys

CUDA_PATH = os.environ.get("CUDA_PATH")
CUDA_INCLUDE_PATH = None
CCCL_INCLUDE_PATHS = None
if CUDA_PATH is not None:
path = os.path.join(CUDA_PATH, "include")
if os.path.isdir(path):
CUDA_INCLUDE_PATH = path
CCCL_INCLUDE_PATHS = (path,)
path = os.path.join(path, "cccl")
if os.path.isdir(path):
CCCL_INCLUDE_PATHS = (path,) + CCCL_INCLUDE_PATHS


try:
import cuda_python_test_helpers
except ImportError:
# Import shared platform helpers for tests across repos
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2] / "cuda_python_test_helpers"))
import cuda_python_test_helpers

# If we imported the package instead of the module, get the actual module
if hasattr(cuda_python_test_helpers, "__path__"):
# We imported the package, need to get the actual module
import cuda_python_test_helpers.cuda_python_test_helpers as cuda_python_test_helpers


IS_WSL = cuda_python_test_helpers.IS_WSL
supports_ipc_mempool = cuda_python_test_helpers.supports_ipc_mempool


del cuda_python_test_helpers
3 changes: 3 additions & 0 deletions cuda_bindings/tests/test_graphics_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

import pytest
from cuda.bindings import runtime as cudart
from helpers import IS_WSL


@pytest.mark.skipif(IS_WSL, reason="Graphics interop not supported on this platform")
def test_graphics_api_smoketest():
Comment thread
leofang marked this conversation as resolved.
# Due to lazy importing in pyglet, pytest.importorskip doesn't work
try:
Expand All @@ -26,6 +28,7 @@ def test_graphics_api_smoketest():
assert error_name in ("cudaErrorInvalidValue", "cudaErrorUnknown")
Comment thread
leofang marked this conversation as resolved.


@pytest.mark.skipif(IS_WSL, reason="Graphics interop not supported on this platform")
def test_cuda_register_image_invalid():
"""Exercise cudaGraphicsGLRegisterImage with dummy handle only using CUDA runtime API."""
fake_gl_texture_id = 1
Expand Down
Loading