2424
2525import pytest
2626
27+ from cuda .pathfinder import get_cuda_path_or_home
28+
2729# build_hooks.py imports Cython and setuptools at the top level, so skip if not available
2830pytest .importorskip ("Cython" )
2931pytest .importorskip ("setuptools" )
@@ -68,6 +70,7 @@ def _check_version_detection(
6870
6971 build_hooks ._get_cuda_path .cache_clear ()
7072 build_hooks ._determine_cuda_major_version .cache_clear ()
73+ get_cuda_path_or_home .cache_clear ()
7174
7275 mock_env = {
7376 k : v
@@ -92,6 +95,7 @@ def test_env_var_override(self, version):
9295 """CUDA_CORE_BUILD_MAJOR env var override works with various versions."""
9396 build_hooks ._get_cuda_path .cache_clear ()
9497 build_hooks ._determine_cuda_major_version .cache_clear ()
98+ get_cuda_path_or_home .cache_clear ()
9599 with mock .patch .dict (os .environ , {"CUDA_CORE_BUILD_MAJOR" : version }, clear = False ):
96100 result = build_hooks ._determine_cuda_major_version ()
97101 assert result == version
@@ -125,6 +129,7 @@ def test_missing_cuda_path_raises_error(self):
125129 """RuntimeError is raised when CUDA_PATH/CUDA_HOME not set and no env var override."""
126130 build_hooks ._get_cuda_path .cache_clear ()
127131 build_hooks ._determine_cuda_major_version .cache_clear ()
132+ get_cuda_path_or_home .cache_clear ()
128133 with (
129134 mock .patch .dict (os .environ , {}, clear = True ),
130135 pytest .raises (RuntimeError , match = "CUDA_PATH or CUDA_HOME" ),
0 commit comments