MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / test_invalid_manifest_gcd

Function test_invalid_manifest_gcd

tests/commands/gc_test.py:148–167  ·  view source on GitHub ↗
(tempdir_factory, store, in_git_dir, cap_out)

Source from the content-addressed store, hash-verified

146
147
148def test_invalid_manifest_gcd(tempdir_factory, store, in_git_dir, cap_out):
149 # clean up repos from old pre-commit versions
150 path = make_repo(tempdir_factory, 'script_hooks_repo')
151 write_config('.', make_config_from_repo(path))
152 store.mark_config_used(C.CONFIG_FILE)
153
154 # trigger a clone
155 install_hooks(C.CONFIG_FILE, store)
156
157 # we'll "break" the manifest to simulate an old version clone
158 with store.connect() as db:
159 path, = db.execute('SELECT path FROM repos').fetchone()
160 os.remove(os.path.join(path, C.MANIFEST_FILE))
161
162 assert _config_count(store) == 1
163 assert _repo_count(store) == 1
164 assert not gc(store)
165 assert _config_count(store) == 1
166 assert _repo_count(store) == 0
167 assert cap_out.get().splitlines()[-1] == '1 repo(s) removed.'
168
169
170def test_gc_pre_1_14_roll_forward(store, cap_out):

Callers

nothing calls this directly

Calls 10

make_repoFunction · 0.90
write_configFunction · 0.90
make_config_from_repoFunction · 0.90
install_hooksFunction · 0.90
gcFunction · 0.90
_config_countFunction · 0.85
_repo_countFunction · 0.85
mark_config_usedMethod · 0.80
connectMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected