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:718–735  ·  view source on GitHub ↗

Test that run_module_command invokes python -m .

(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

run_module_commandFunction · 0.90

Tested by

no test coverage detected