File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
cuda_core/tests/memory_ipc Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 55import gc
66import multiprocessing as mp
77
8- import psutil
8+ try :
9+ import psutil
10+ except ImportError :
11+ HAVE_PSUTIL = False
12+ else :
13+ HAVE_PSUTIL = True
14+
915import pytest
1016from cuda .core .experimental import _memory
1117from cuda .core .experimental ._utils .cuda_utils import driver
1420NBYTES = 64
1521
1622USING_FDS = _memory ._IPC_HANDLE_TYPE == driver .CUmemAllocationHandleType .CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR
17- skip_unless_using_fds = pytest .mark .skipif (not USING_FDS , reason = "mempool allocation handle is not using fds" )
23+ skip_if_unrunnable = pytest .mark .skipif (
24+ not USING_FDS or not HAVE_PSUTIL , reason = "mempool allocation handle is not using fds or psutil is unavailable"
25+ )
1826
1927
20- @skip_unless_using_fds
28+ @skip_if_unrunnable
2129def test_alloc_handle (ipc_memory_resource ):
2230 """Check for fd leaks in get_allocation_handle."""
2331 mr = ipc_memory_resource
@@ -73,7 +81,7 @@ def __reduce__(self):
7381 raise RuntimeError ("Irreducible" )
7482
7583
76- @skip_unless_using_fds
84+ @skip_if_unrunnable
7785@pytest .mark .parametrize (
7886 "getobject" ,
7987 [
You can’t perform that action at this time.
0 commit comments