File tree Expand file tree Collapse file tree 3 files changed +19
-11
lines changed
cuda_python_test_helpers/cuda_python_test_helpers Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Original file line number Diff line number Diff line change 2222 import cuda_python_test_helpers
2323except ImportError :
2424 # Import shared platform helpers for tests across repos
25- sys .path .insert (0 , str (pathlib .Path (__file__ ).resolve ().parents [2 ] / "cuda_python_test_helpers" ))
26- import cuda_python_test_helpers
27-
28- # If we imported the package instead of the module, get the actual module
29- if hasattr (cuda_python_test_helpers , "__path__" ):
30- # We imported the package, need to get the actual module
31- import cuda_python_test_helpers .cuda_python_test_helpers as cuda_python_test_helpers
25+ test_helpers_path = str (pathlib .Path (__file__ ).resolve ().parents [2 ] / "cuda_python_test_helpers" )
26+ try :
27+ sys .path .insert (0 , test_helpers_path )
28+ import cuda_python_test_helpers
29+ finally :
30+ # Clean up sys.path modification
31+ if test_helpers_path in sys .path :
32+ sys .path .remove (test_helpers_path )
3233
3334
3435IS_WSL = cuda_python_test_helpers .IS_WSL
Original file line number Diff line number Diff line change 2222 import cuda_python_test_helpers
2323except ImportError :
2424 # Import shared platform helpers for tests across repos
25- sys .path .insert (0 , str (pathlib .Path (__file__ ).resolve ().parents [2 ] / "cuda_python_test_helpers" ))
26- import cuda_python_test_helpers
25+ test_helpers_path = str (pathlib .Path (__file__ ).resolve ().parents [2 ] / "cuda_python_test_helpers" )
26+ try :
27+ sys .path .insert (0 , test_helpers_path )
28+ import cuda_python_test_helpers
29+ finally :
30+ # Clean up sys.path modification
31+ if test_helpers_path in sys .path :
32+ sys .path .remove (test_helpers_path )
2733
2834
2935IS_WSL = cuda_python_test_helpers .IS_WSL
Original file line number Diff line number Diff line change 66from contextlib import suppress
77from typing import Union
88
9- from cuda .core .experimental ._utils .cuda_utils import handle_return
10-
119
1210def _detect_wsl () -> bool :
1311 data = ""
@@ -39,6 +37,9 @@ def supports_ipc_mempool(device_id: Union[int, object]) -> bool:
3937 except Exception :
4038 from cuda import cuda as driver # type: ignore
4139
40+ # Lazy import handle_return to avoid hard dependency on cuda.core
41+ from cuda .core .experimental ._utils .cuda_utils import handle_return
42+
4243 # Initialize CUDA
4344 handle_return (driver .cuInit (0 ))
4445
You can’t perform that action at this time.
0 commit comments