Handle missing npx.cmd fallback on Windows 🤖 Generated with GPT-5.2-Codex (#3416)

This commit is contained in:
Jeremiah Lowin 2026-03-07 11:40:57 -05:00 committed by GitHub
commit dcaeef0f3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View file

@ -440,6 +440,23 @@ class TestWindowsSpecific:
assert result == "npx.exe"
assert mock_run.call_count == 2
@patch("subprocess.run")
def test_get_npx_command_windows_cmd_missing(self, mock_run):
"""Test npx command detection continues when npx.cmd is missing."""
from fastmcp.cli.cli import _get_npx_command
with patch("sys.platform", "win32"):
# Missing npx.cmd should not abort detection
mock_run.side_effect = [
FileNotFoundError("npx.cmd not found"),
Mock(returncode=0),
]
result = _get_npx_command()
assert result == "npx.exe"
assert mock_run.call_count == 2
@patch("subprocess.run")
def test_get_npx_command_windows_fallback(self, mock_run):
"""Test npx command detection on Windows with plain npx."""