Test that env_command_builder wraps the command.
(self)
| 963 | assert "0.0.0.0" in cmd |
| 964 | |
| 965 | def test_uses_env_command_builder(self): |
| 966 | """Test that env_command_builder wraps the command.""" |
| 967 | mock_result = MagicMock() |
| 968 | mock_result.returncode = 0 |
| 969 | |
| 970 | def fake_builder(cmd: list[str]) -> list[str]: |
| 971 | return ["uv", "run", *cmd] |
| 972 | |
| 973 | with ( |
| 974 | patch( |
| 975 | "fastmcp.cli.run.subprocess.run", return_value=mock_result |
| 976 | ) as mock_run, |
| 977 | pytest.raises(SystemExit), |
| 978 | ): |
| 979 | run_module_command("my_package", env_command_builder=fake_builder) |
| 980 | |
| 981 | cmd = mock_run.call_args[0][0] |
| 982 | assert cmd[0] == "uv" |
| 983 | assert cmd[1] == "run" |
| 984 | # Should use bare "python" (not sys.executable) so uv resolves the interpreter |
| 985 | assert cmd[2] == "python" |
| 986 | assert "-m" in cmd |
| 987 | assert "my_package" in cmd |
| 988 | |
| 989 | def test_exits_with_subprocess_error_code(self): |
| 990 | """Test that non-zero exit codes from the module are propagated.""" |
nothing calls this directly
no test coverage detected