MCPcopy
hub / github.com/coderamp-labs/gitingest / test_git_command_failure

Function test_git_command_failure

tests/test_clone.py:142–154  ·  view source on GitHub ↗

Test cloning when the Git command fails during execution. Given a valid URL, but ``run_command`` raises a RuntimeError: When ``clone_repo`` is called, Then a RuntimeError should be raised with the correct message.

(run_command_mock: AsyncMock)

Source from the content-addressed store, hash-verified

140
141@pytest.mark.asyncio
142async def test_git_command_failure(run_command_mock: AsyncMock) -> None:
143 """Test cloning when the Git command fails during execution.
144
145 Given a valid URL, but ``run_command`` raises a RuntimeError:
146 When ``clone_repo`` is called,
147 Then a RuntimeError should be raised with the correct message.
148 """
149 clone_config = CloneConfig(url=DEMO_URL, local_path=LOCAL_REPO_PATH)
150
151 run_command_mock.side_effect = RuntimeError("Git is not installed or not accessible. Please install Git first.")
152
153 with pytest.raises(RuntimeError, match="Git is not installed or not accessible"):
154 await clone_repo(clone_config)
155
156
157@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 2

CloneConfigClass · 0.90
clone_repoFunction · 0.90

Tested by

no test coverage detected