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

Function test_clone_with_include_submodules

tests/test_clone.py:307–322  ·  view source on GitHub ↗

Test cloning a repository with submodules included. Given a valid URL and ``include_submodules=True``: When ``clone_repo`` is called, Then the repository should be cloned with ``--recurse-submodules`` in the git command.

(run_command_mock: AsyncMock)

Source from the content-addressed store, hash-verified

305
306@pytest.mark.asyncio
307async def test_clone_with_include_submodules(run_command_mock: AsyncMock) -> None:
308 """Test cloning a repository with submodules included.
309
310 Given a valid URL and ``include_submodules=True``:
311 When ``clone_repo`` is called,
312 Then the repository should be cloned with ``--recurse-submodules`` in the git command.
313 """
314 # ensure_git_installed + resolve_commit + clone + fetch + checkout + checkout submodules
315 expected_call_count = GIT_INSTALLED_CALLS + 5
316 clone_config = CloneConfig(url=DEMO_URL, local_path=LOCAL_REPO_PATH, branch="main", include_submodules=True)
317
318 await clone_repo(clone_config)
319
320 assert_standard_calls(run_command_mock, clone_config, commit=DEMO_COMMIT)
321 assert_submodule_calls(run_command_mock, clone_config)
322 assert run_command_mock.call_count == expected_call_count
323
324
325def assert_standard_calls(mock: AsyncMock, cfg: CloneConfig, commit: str, *, partial_clone: bool = False) -> None:

Callers

nothing calls this directly

Calls 4

CloneConfigClass · 0.90
clone_repoFunction · 0.90
assert_standard_callsFunction · 0.85
assert_submodule_callsFunction · 0.85

Tested by

no test coverage detected