(tempdir_factory, store, in_git_dir, cap_out)
| 37 | |
| 38 | |
| 39 | def test_gc(tempdir_factory, store, in_git_dir, cap_out): |
| 40 | path = make_repo(tempdir_factory, 'script_hooks_repo') |
| 41 | old_rev = git.head_rev(path) |
| 42 | git_commit(cwd=path) |
| 43 | |
| 44 | write_config('.', make_config_from_repo(path, rev=old_rev)) |
| 45 | store.mark_config_used(C.CONFIG_FILE) |
| 46 | |
| 47 | # update will clone both the old and new repo, making the old one gc-able |
| 48 | assert not install_hooks(C.CONFIG_FILE, store) |
| 49 | assert not autoupdate(C.CONFIG_FILE, freeze=False, tags_only=False) |
| 50 | assert not install_hooks(C.CONFIG_FILE, store) |
| 51 | |
| 52 | assert _config_count(store) == 1 |
| 53 | assert _repo_count(store) == 2 |
| 54 | assert not gc(store) |
| 55 | assert _config_count(store) == 1 |
| 56 | assert _repo_count(store) == 1 |
| 57 | assert cap_out.get().splitlines()[-1] == '1 repo(s) removed.' |
| 58 | |
| 59 | _remove_config_assert_cleared(store, cap_out) |
| 60 | |
| 61 | |
| 62 | def test_gc_repo_not_cloned(tempdir_factory, store, in_git_dir, cap_out): |
nothing calls this directly
no test coverage detected