Remove bad test

This commit is contained in:
Jeremiah Lowin 2025-04-20 17:51:37 -07:00
commit bfda92e95c

View file

@ -1,11 +1,4 @@
from pathlib import Path
from unittest.mock import Mock, patch
import pytest
from typer.testing import CliRunner
from fastmcp import FastMCP
from fastmcp.cli.cli import app
@pytest.fixture
@ -27,51 +20,3 @@ if __name__ == "__main__":
"""
)
return server_path
def test_cli_run_transport_kwargs():
"""Test that transport_kwargs are correctly passed from CLI to server.run()"""
runner = CliRunner()
# Need to mock both the file parsing and the server import
with (
patch("fastmcp.cli.cli._parse_file_path") as mock_parse_file_path,
patch("fastmcp.cli.cli._import_server") as mock_import_server,
):
# Make _parse_file_path return a fake path and server object
mock_parse_file_path.return_value = (Path("fake_server.py"), "mcp")
# Create a mock server with a mock run method
mock_server = FastMCP(name="MockServer")
mock_server.run = Mock()
# Make _import_server return our mock server
mock_import_server.return_value = mock_server
# Run the CLI command with transport_kwargs
result = runner.invoke(
app,
[
"run",
"fake_server.py",
"--transport",
"sse",
"--host",
"127.0.0.1",
"--port",
"9000",
"--log-level",
"DEBUG",
],
)
# Check that the run method was called with the correct kwargs
mock_server.run.assert_called_once_with(
transport="sse",
host="127.0.0.1",
port=9000,
log_level="DEBUG",
)
# Check CLI command succeeded
assert result.exit_code == 0