MCPcopy Create free account
hub / github.com/PrefectHQ/fastmcp / test_runs_python_m_module

Method test_runs_python_m_module

tests/cli/test_run.py:929–946  ·  view source on GitHub ↗

Test that run_module_command invokes python -m .

(self)

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls 1

run_module_commandFunction · 0.90

Tested by

no test coverage detected