Support factory functions in fastmcp run (#1384)

This commit is contained in:
Jeremiah Lowin 2025-08-06 13:12:52 -04:00 committed by GitHub
commit d52d6d8fff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 249 additions and 143 deletions

View file

@ -306,7 +306,7 @@ class TestCursorCommand:
@patch("fastmcp.cli.install.cursor.install_cursor")
@patch("fastmcp.cli.install.cursor.process_common_args")
def test_cursor_command_basic(self, mock_process_args, mock_install):
async def test_cursor_command_basic(self, mock_process_args, mock_install):
"""Test basic cursor command execution."""
mock_process_args.return_value = (
Path("server.py"),
@ -318,7 +318,7 @@ class TestCursorCommand:
mock_install.return_value = True
with patch("sys.exit") as mock_exit:
cursor_command("server.py")
await cursor_command("server.py")
mock_install.assert_called_once_with(
file=Path("server.py"),
@ -335,7 +335,7 @@ class TestCursorCommand:
@patch("fastmcp.cli.install.cursor.install_cursor")
@patch("fastmcp.cli.install.cursor.process_common_args")
def test_cursor_command_failure(self, mock_process_args, mock_install):
async def test_cursor_command_failure(self, mock_process_args, mock_install):
"""Test cursor command when installation fails."""
mock_process_args.return_value = (
Path("server.py"),
@ -347,6 +347,6 @@ class TestCursorCommand:
mock_install.return_value = False
with pytest.raises(SystemExit) as exc_info:
cursor_command("server.py")
await cursor_command("server.py")
assert exc_info.value.code == 1