Skip to content

Commit 59ff7bd

Browse files
committed
test: load shared pytest safeguards for CUDA 12 bindings
1 parent 5deacef commit 59ff7bd

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎cuda_bindings_12/tests/conftest.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
import importlib
5+
import pathlib
6+
import sys
7+
8+
# Keep the shared pytest plugin available in wheel-test jobs, which run from
9+
# the monorepo checkout without installing cuda-python-test-helpers.
10+
try:
11+
import cuda_python_test_helpers._pytest_plugin # noqa: F401
12+
except ImportError as e:
13+
_test_helpers_root = pathlib.Path(__file__).parents[2] / "cuda_python_test_helpers"
14+
if not _test_helpers_root.is_dir():
15+
raise RuntimeError(f"cuda-python-test-helpers not installed and not found at {_test_helpers_root}") from e
16+
for _key in list(sys.modules):
17+
if _key == "cuda_python_test_helpers" or _key.startswith("cuda_python_test_helpers."):
18+
del sys.modules[_key]
19+
sys.path.insert(0, str(_test_helpers_root))
20+
importlib.invalidate_caches()
21+
22+
pytest_plugins = ["cuda_python_test_helpers._pytest_plugin"]

0 commit comments

Comments
 (0)