Test that run_module_command invokes python -m .
(self)
| 716 | """Test run_module_command functionality.""" |
| 717 | |
| 718 | def test_runs_python_m_module(self): |
| 719 | """Test that run_module_command invokes python -m <module>.""" |
| 720 | mock_result = MagicMock() |
| 721 | mock_result.returncode = 0 |
| 722 | |
| 723 | with ( |
| 724 | patch( |
| 725 | "fastmcp.cli.run.subprocess.run", return_value=mock_result |
| 726 | ) as mock_run, |
| 727 | pytest.raises(SystemExit) as exc_info, |
| 728 | ): |
| 729 | run_module_command("my_package") |
| 730 | |
| 731 | assert exc_info.value.code == 0 |
| 732 | call_args = mock_run.call_args |
| 733 | cmd = call_args[0][0] |
| 734 | assert "-m" in cmd |
| 735 | assert "my_package" in cmd |
| 736 | |
| 737 | def test_forwards_extra_args(self): |
| 738 | """Test that extra arguments are forwarded after the module name.""" |
nothing calls this directly
no test coverage detected