diff --git a/tests/hermes_cli/test_gateway_service.py b/tests/hermes_cli/test_gateway_service.py index 3a36050e4c..72798684e2 100644 --- a/tests/hermes_cli/test_gateway_service.py +++ b/tests/hermes_cli/test_gateway_service.py @@ -332,9 +332,11 @@ class TestGeneratedSystemdUnits: assert f"RestartForceExitStatus={GATEWAY_SERVICE_RESTART_EXIT_CODE}" in unit assert f"RestartPreventExitStatus={GATEWAY_FATAL_CONFIG_EXIT_CODE}" in unit - def test_user_unit_carries_ld_library_path_escaped_for_systemd(self, monkeypatch): + def test_user_unit_carries_ld_library_path_escaped_for_systemd(self, monkeypatch, tmp_path): """#14613: glibc reads LD_LIBRARY_PATH only at process start, so the unit file is the only place it can reach CUDA-backed tools; quotes/backslashes must survive systemd quoting.""" + # The absent-env branch falls back to the installed unit: keep the host's real one out. + monkeypatch.setattr(gateway_cli, "get_systemd_unit_path", lambda system=False: tmp_path / "hermes-gateway.service") monkeypatch.setenv("LD_LIBRARY_PATH", '/opt/cu"da/lib64:/opt/back\\slash/lib') unit = gateway_cli.generate_systemd_unit(system=False)