From 5cb8f62a0242789393ee72ddb78f9b8e87699383 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Mon, 2 Feb 2026 15:53:34 +0000 Subject: [PATCH] Fix test_install_dotnet_uses_bash_script_on_linux platform detection The test was mocking platform.system() but not the full platform detection chain. On non-Linux CI platforms, platform.libc_ver() returns empty string, causing "linux--x64" (double dash) instead of "linux-x64" in the platform ID. Fix by mocking PlatformUtils.get_platform_id() directly to return proper PlatformId values, following the pattern used in other tests. Fixes both Linux bash script and Windows PowerShell script tests. --- test/solidlsp/csharp/test_csharp_dotnet_install.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/solidlsp/csharp/test_csharp_dotnet_install.py b/test/solidlsp/csharp/test_csharp_dotnet_install.py index bd80d47d..f59db6e5 100644 --- a/test/solidlsp/csharp/test_csharp_dotnet_install.py +++ b/test/solidlsp/csharp/test_csharp_dotnet_install.py @@ -15,13 +15,19 @@ class TestDotNetInstallScript: """Test .NET runtime installation using Microsoft's official install scripts.""" @patch("solidlsp.language_servers.csharp_language_server.CSharpLanguageServer.DependencyProvider._ensure_language_server") + @patch("solidlsp.language_servers.common.PlatformUtils.get_platform_id") @patch("solidlsp.language_servers.csharp_language_server.platform.system") @patch("solidlsp.language_servers.csharp_language_server.subprocess.run") @patch("solidlsp.language_servers.csharp_language_server.urllib.request.urlretrieve") @patch("solidlsp.language_servers.csharp_language_server.shutil.which") - def test_install_dotnet_uses_bash_script_on_linux(self, mock_which, mock_urlretrieve, mock_subprocess, mock_platform, mock_ensure_ls): + def test_install_dotnet_uses_bash_script_on_linux( + self, mock_which, mock_urlretrieve, mock_subprocess, mock_platform, mock_platform_id, mock_ensure_ls + ): """Test that Linux uses bash install script.""" + from solidlsp.ls_utils import PlatformId + mock_platform.return_value = "Linux" + mock_platform_id.return_value = PlatformId.LINUX_x64 mock_which.return_value = None # No system dotnet mock_ensure_ls.return_value = "/fake/server.dll" @@ -57,15 +63,19 @@ class TestDotNetInstallScript: assert script_url == "https://dot.net/v1/dotnet-install.sh" @patch("solidlsp.language_servers.csharp_language_server.CSharpLanguageServer.DependencyProvider._ensure_language_server") + @patch("solidlsp.language_servers.common.PlatformUtils.get_platform_id") @patch("solidlsp.language_servers.csharp_language_server.platform.system") @patch("solidlsp.language_servers.csharp_language_server.subprocess.run") @patch("solidlsp.language_servers.csharp_language_server.urllib.request.urlretrieve") @patch("solidlsp.language_servers.csharp_language_server.shutil.which") def test_install_dotnet_uses_powershell_script_on_windows( - self, mock_which, mock_urlretrieve, mock_subprocess, mock_platform, mock_ensure_ls + self, mock_which, mock_urlretrieve, mock_subprocess, mock_platform, mock_platform_id, mock_ensure_ls ): """Test that Windows uses PowerShell install script.""" + from solidlsp.ls_utils import PlatformId + mock_platform.return_value = "Windows" + mock_platform_id.return_value = PlatformId.WIN_x64 mock_which.return_value = None # No system dotnet mock_ensure_ls.return_value = "/fake/server.dll"