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

Function test_clone_creates_parent_directory

tests/test_clone.py:247–263  ·  view source on GitHub ↗

Test that ``clone_repo`` creates parent directories if they don't exist. Given a local path with non-existent parent directories: When ``clone_repo`` is called, Then it should create the parent directories before attempting to clone.

(tmp_path: Path, run_command_mock: AsyncMock)

Source from the content-addressed store, hash-verified

245
246@pytest.mark.asyncio
247async def test_clone_creates_parent_directory(tmp_path: Path, run_command_mock: AsyncMock) -> None:
248 """Test that ``clone_repo`` creates parent directories if they don't exist.
249
250 Given a local path with non-existent parent directories:
251 When ``clone_repo`` is called,
252 Then it should create the parent directories before attempting to clone.
253 """
254 expected_call_count = GIT_INSTALLED_CALLS + 4 # ensure_git_installed + resolve_commit + clone + fetch + checkout
255 nested_path = tmp_path / "deep" / "nested" / "path" / "repo"
256
257 clone_config = CloneConfig(url=DEMO_URL, local_path=str(nested_path))
258
259 await clone_repo(clone_config)
260
261 assert nested_path.parent.exists()
262 assert_standard_calls(run_command_mock, clone_config, commit=DEMO_COMMIT)
263 assert run_command_mock.call_count == expected_call_count
264
265
266@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 3

CloneConfigClass · 0.90
clone_repoFunction · 0.90
assert_standard_callsFunction · 0.85

Tested by

no test coverage detected