Test that run_module_command invokes python -m .
(self)
| 927 | """Test run_module_command functionality.""" |
| 928 | |
| 929 | def test_runs_python_m_module(self): |
| 930 | """Test that run_module_command invokes python -m <module>.""" |
| 931 | mock_result = MagicMock() |
| 932 | mock_result.returncode = 0 |
| 933 | |
| 934 | with ( |
| 935 | patch( |
| 936 | "fastmcp.cli.run.subprocess.run", return_value=mock_result |
| 937 | ) as mock_run, |
| 938 | pytest.raises(SystemExit) as exc_info, |
| 939 | ): |
| 940 | run_module_command("my_package") |
| 941 | |
| 942 | assert exc_info.value.code == 0 |
| 943 | call_args = mock_run.call_args |
| 944 | cmd = call_args[0][0] |
| 945 | assert "-m" in cmd |
| 946 | assert "my_package" in cmd |
| 947 | |
| 948 | def test_forwards_extra_args(self): |
| 949 | """Test that extra arguments are forwarded after the module name.""" |
nothing calls this directly
no test coverage detected