Skip to content

Commit 27db0a7

Browse files
committed
Use os.path.samefile() to resolve issues with doubled backslashes.
1 parent 2b74022 commit 27db0a7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cuda_bindings/tests/test_path_finder_load.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def test_find_or_load_nvidia_dynamic_library(info_summary_append, libname):
4848
# Defining the subprocess code snippets as strings ensures each subprocess
4949
# runs a minimal, independent script tailored to the specific libname and API being tested.
5050
code = f"""\
51+
import os
5152
from cuda.bindings.path_finder import _load_nvidia_dynamic_library
5253
from cuda.bindings._path_finder.load_nvidia_dynamic_library import _load_nvidia_dynamic_library_no_cache
5354
@@ -62,8 +63,8 @@ def test_find_or_load_nvidia_dynamic_library(info_summary_append, libname):
6263
loaded_dl_no_cache = _load_nvidia_dynamic_library_no_cache({libname!r})
6364
if not loaded_dl_no_cache.was_already_loaded_from_elsewhere:
6465
raise RuntimeError("loaded_dl_no_cache.was_already_loaded_from_elsewhere")
65-
if loaded_dl_no_cache.abs_path != loaded_dl_fresh.abs_path:
66-
raise RuntimeError(f"{{loaded_dl_no_cache.abs_path=!r}} != {{loaded_dl_fresh.abs_path=!r}}")
66+
if not os.path.samefile(loaded_dl_no_cache.abs_path, loaded_dl_fresh.abs_path):
67+
raise RuntimeError(f"not os.path.samefile({{loaded_dl_no_cache.abs_path=!r}}, {{loaded_dl_fresh.abs_path=!r}})")
6768
6869
print(f"{{loaded_dl_fresh.abs_path!r}}")
6970
"""

0 commit comments

Comments
 (0)