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

Function test_clone_with_commit_and_subpath

tests/test_clone.py:287–303  ·  view source on GitHub ↗

Test cloning a repository with both a specific commit and subpath. Given a valid repository URL, commit hash, and subpath: When ``clone_repo`` is called, Then the repository should be cloned with sparse checkout enabled, checked out at the specific commit, and only include the speci

(run_command_mock: AsyncMock)

Source from the content-addressed store, hash-verified

285
286@pytest.mark.asyncio
287async def test_clone_with_commit_and_subpath(run_command_mock: AsyncMock) -> None:
288 """Test cloning a repository with both a specific commit and subpath.
289
290 Given a valid repository URL, commit hash, and subpath:
291 When ``clone_repo`` is called,
292 Then the repository should be cloned with sparse checkout enabled,
293 checked out at the specific commit, and only include the specified subpath.
294 """
295 subpath = "src/docs"
296 expected_call_count = GIT_INSTALLED_CALLS + 4 # ensure_git_installed + clone + sparse-checkout + fetch + checkout
297 commit_hash = "a" * 40 # Simulating a valid commit hash
298 clone_config = CloneConfig(url=DEMO_URL, local_path=LOCAL_REPO_PATH, commit=commit_hash, subpath=subpath)
299
300 await clone_repo(clone_config)
301
302 assert_partial_clone_calls(run_command_mock, clone_config, commit=commit_hash)
303 assert run_command_mock.call_count == expected_call_count
304
305
306@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 3

CloneConfigClass · 0.90
clone_repoFunction · 0.90

Tested by

no test coverage detected