-
Notifications
You must be signed in to change notification settings - Fork 217
Skipping test_graphics_apis.py when running on WSL
#1166
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
base: main
Are you sure you want to change the base?
Changes from all commits
e5a4b3c
d2856cc
ae3f200
e6f4c9f
9da73e3
6927cfe
da2ae80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # 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 | ||
| test_helpers_path = str(pathlib.Path(__file__).resolve().parents[2] / "cuda_python_test_helpers") | ||
| try: | ||
| sys.path.insert(0, test_helpers_path) | ||
| import cuda_python_test_helpers | ||
| finally: | ||
| # Clean up sys.path modification | ||
| if test_helpers_path in sys.path: | ||
| sys.path.remove(test_helpers_path) | ||
|
Comment on lines
+26
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: The |
||
|
|
||
|
|
||
| IS_WSL = cuda_python_test_helpers.IS_WSL | ||
| supports_ipc_mempool = cuda_python_test_helpers.supports_ipc_mempool | ||
|
|
||
|
|
||
| del cuda_python_test_helpers | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 on lines
+9
to
10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: This skipif decorator now prevents the test from running on WSL, which contradicts the PR description. The description says "Adding cudaErrorOperatingSystem to the error tuple" but the actual change removed that error from the assertion and skips WSL entirely instead. Was the intention to skip the test on WSL (as implemented) or to allow it to run while accepting cudaErrorOperatingSystem as a valid error (as the PR title suggests)? |
||
| # Due to lazy importing in pyglet, pytest.importorskip doesn't work | ||
| try: | ||
|
|
@@ -26,6 +28,7 @@ def test_graphics_api_smoketest(): | |
| assert error_name in ("cudaErrorInvalidValue", "cudaErrorUnknown") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: The PR description says "Adding cudaErrorOperatingSystem" but line 28 shows it was removed from the acceptable errors. The original code had "cudaErrorOperatingSystem" in this tuple and the change removed it. |
||
|
|
||
|
|
||
| @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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,8 +22,14 @@ | |
| 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 | ||
| test_helpers_path = str(pathlib.Path(__file__).resolve().parents[2] / "cuda_python_test_helpers") | ||
| try: | ||
| sys.path.insert(0, test_helpers_path) | ||
| import cuda_python_test_helpers | ||
| finally: | ||
| # Clean up sys.path modification | ||
| if test_helpers_path in sys.path: | ||
| sys.path.remove(test_helpers_path) | ||
|
Comment on lines
+30
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are you trying to achieve here by removing this from The import system will keep There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding was its preventing polluting global state because the import path changes is alive for the duration of the lifetime of the interpreter process.
Comment on lines
+26
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: The |
||
|
|
||
|
|
||
| IS_WSL = cuda_python_test_helpers.IS_WSL | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: If the import on line 28 fails, the path remains in
sys.pathsince thefinallyblock's removal is conditional. Consider moving the import outside the try-finally and only wrapping thesys.pathmanipulation, or ensure the path is always removed regardless of import success.