MCPcopy Create free account
hub / github.com/libgit2/pygit2 / test_add_submodule

Function test_add_submodule

test/test_submodule.py:247–263  ·  view source on GitHub ↗
(repo: Repository, depth: int)

Source from the content-addressed store, hash-verified

245@utils.requires_network
246@pytest.mark.parametrize('depth', [0, 1])
247def test_add_submodule(repo: Repository, depth: int) -> None:
248 sm_repo_path = 'test/testrepo'
249 sm = repo.submodules.add(SUBM_URL, sm_repo_path, depth=depth)
250
251 status = repo.submodules.status(sm_repo_path)
252 assert status == (SS.IN_INDEX | SS.IN_CONFIG | SS.IN_WD | SS.INDEX_ADDED)
253
254 sm_repo = sm.open()
255 assert sm_repo_path == sm.path
256 assert SUBM_URL == sm.url
257 assert not sm_repo.is_empty
258
259 if depth == 0:
260 sm_repo[SUBM_BOTTOM_SHA] # full history must be available
261 else:
262 with pytest.raises(KeyError):
263 sm_repo[SUBM_BOTTOM_SHA] # shallow clone
264
265
266@utils.requires_network

Callers

nothing calls this directly

Calls 3

statusMethod · 0.80
openMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…