File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 44import functools
55import json
66import os
7+ import shlex
8+ from subprocess import list2cmdline # nosec B404
79from unittest .mock import patch
810
911import pytest
@@ -91,6 +93,12 @@ def _get_libnames_for_test_load_nvidia_dynamic_lib():
9193 return tuple (result )
9294
9395
96+ def _quote_for_shell_copypaste (s ):
97+ if os .name == "nt" :
98+ return list2cmdline ([s ])
99+ return shlex .quote (s )
100+
101+
94102@pytest .mark .parametrize ("libname" , _get_libnames_for_test_load_nvidia_dynamic_lib ())
95103def test_load_nvidia_dynamic_lib (info_summary_append , libname ):
96104 # We intentionally run each dynamic library operation in a child process
@@ -112,5 +120,5 @@ def raise_child_process_failed():
112120 info_summary_append (f"Not found: { libname = !r} " )
113121 else :
114122 abs_path = json .loads (result .stdout .rstrip ())
115- info_summary_append (f"{ abs_path = } " )
123+ info_summary_append (f"abs_path={ _quote_for_shell_copypaste ( abs_path ) } " )
116124 assert os .path .isfile (abs_path ) # double-check the abs_path
You can’t perform that action at this time.
0 commit comments