Skip to content

Commit 04307fe

Browse files
rwgkcursoragent
andcommitted
test: tolerate missing mempool xfail helper
Allow cuda_core tests to run against older cuda.bindings artifacts by falling back when the mempool xfail helper is unavailable, so collection succeeds without the new OOM xfail behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d757fa0 commit 04307fe

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

cuda_core/tests/conftest.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from cuda import cuda as driver
1818

1919
import cuda.core
20-
from cuda.bindings._test_helpers.mempool import xfail_if_mempool_oom
2120
from cuda.core import (
2221
Device,
2322
DeviceMemoryResource,
@@ -30,6 +29,16 @@
3029
)
3130
from cuda.core._utils.cuda_utils import CUDAError, handle_return
3231

32+
try:
33+
from cuda.bindings._test_helpers.mempool import xfail_if_mempool_oom
34+
except ModuleNotFoundError:
35+
# Older cuda.bindings artifacts (for example 12.9.x backports) do not ship
36+
# this helper yet. In that case, keep the primary failure visible instead of
37+
# xfail-ing the known Windows MCDM mempool setup issue.
38+
def xfail_if_mempool_oom(err_or_exc, api_name=None, device=0):
39+
return
40+
41+
3342
# Import shared test helpers for tests across subprojects.
3443
# PLEASE KEEP IN SYNC with copies in other conftest.py in this repo.
3544
_test_helpers_root = pathlib.Path(__file__).resolve().parents[2] / "cuda_python_test_helpers"

cuda_core/tests/test_managed_memory_warning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import pytest
1414

1515
import cuda.bindings
16-
from cuda.bindings._test_helpers.mempool import xfail_if_mempool_oom
16+
from conftest import xfail_if_mempool_oom
1717
from cuda.core import Device, ManagedMemoryResource, ManagedMemoryResourceOptions
1818
from cuda.core._memory._managed_memory_resource import reset_concurrent_access_warning
1919
from cuda.core._utils.cuda_utils import CUDAError

0 commit comments

Comments
 (0)