test(git-sandbox): share origin_and_repo setup across gc fixtures
CI / security-codeql (push) Canceled after 0s
CI / test-unit (push) Canceled after 0s
CI / test-integration (push) Canceled after 0s
CI / test-env-virtual (push) Canceled after 0s
CI / test-env-nix (push) Canceled after 0s
CI / test-e2e (push) Canceled after 0s
CI / test-virgin-user (push) Canceled after 0s
CI / test-virgin-root (push) Canceled after 0s
CI / lint-shell (push) Canceled after 0s
CI / lint-python (push) Canceled after 0s
CI / lint-docker (push) Canceled after 0s
CI / quality (push) Canceled after 0s

quality/check on PR 21 flagged 4 clean.clones findings: the same bare origin, repo and init commit setup in test_branch_gc.py and risk_fixture.py. Both now call one helper in tests/support/git_sandbox.py.

PR: https://github.com/kevinveenbirkenbach/package-manager/pull/21
Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-12-01 17:46:47 +00:00
1 parent cee58bcef1
commit 4c603a0087
3 files changed
+26 -16

No files matched your search

@@ -12,7 +12,7 @@ from unittest.mock import patch
from pkgmgr.actions.branch import gc
from pkgmgr.actions.branch.gc_forge import ForgeFacts
from pkgmgr.actions.gc.risk import docker_items, plan
from tests.support.git_sandbox import git, isolated_root
from tests.support.git_sandbox import git, isolated_root, origin_and_repo
DAY = 86400
REAL_RUN = subprocess.run
@@ -183,13 +183,7 @@ class RiskPlanFixture:
git(self.repo, "push", "origin", "main")
def _repos(self) -> None:
self.origin = os.path.join(self.root, "origin.git")
self.repo = os.path.join(self.root, "repo")
git(self.root, "init", "--bare", "-b", "main", self.origin)
git(self.root, "init", "-b", "main", self.repo)
git(self.repo, "remote", "add", "origin", self.origin)
self._commit(self.repo, "init")
git(self.repo, "push", "-u", "origin", "main")
self.origin, self.repo = origin_and_repo(self.root)
self._branch("cherry", push=False)
for name in ("done", "stack", "old"):
self._branch(name, push=True, merge=True)