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

Function test_submodule_cache

test/test_submodule.py:319–331  ·  view source on GitHub ↗
(repo: Repository)

Source from the content-addressed store, hash-verified

317
318
319def test_submodule_cache(repo: Repository) -> None:
320 # When the cache is turned on, looking up the same submodule twice must return the same git_submodule object
321 repo.submodules.cache_all()
322 sm1 = repo.submodules[SUBM_NAME]
323 sm2 = repo.submodules[SUBM_NAME]
324 assert sm1._subm == sm2._subm
325
326 # After turning off the cache, each lookup must return a new git_submodule object
327 repo.submodules.cache_clear()
328 sm3 = repo.submodules[SUBM_NAME]
329 sm4 = repo.submodules[SUBM_NAME]
330 assert sm1._subm != sm3._subm
331 assert sm3._subm != sm4._subm
332
333
334def test_submodule_reload(repo: Repository) -> None:

Callers

nothing calls this directly

Calls 2

cache_allMethod · 0.80
cache_clearMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…