Skip to content

Commit 22b095b

Browse files
author
tkucar
committed
patch
1 parent e997909 commit 22b095b

File tree

3 files changed

+93
-5
lines changed

3 files changed

+93
-5
lines changed

src/codegen/sdk/testing/models.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,14 @@ def to_op(self, name: str, token: str | None) -> LocalRepoOperator:
6767
if token:
6868
url = url.replace("://", f"://{token}@")
6969
elif self.repo_id is not None:
70-
print("Setting up auth using the github cli")
70+
# TODO: this is a very messy hack to check whether we should prompt the user for auth
71+
# if REPO_ID_TO_URL is not set, we probably don't need auth. this is assuming that for
72+
# OSS repos, we don't need to pull any private repos.
73+
if not REPO_ID_TO_URL:
74+
return
75+
7176
if not which("gh"):
72-
os.system("brew install gh")
77+
raise RuntimeError("GitHub CLI (gh) is not installed. Please install it first.")
7378
if '[credential "https://github.codegen.app"]' not in (Path.home() / ".gitconfig").read_text():
7479
os.system("gh auth login -h github.codegen.app")
7580
os.system("gh auth setup-git -h github.codegen.app")

tests/codemod/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ def token(request):
141141
def op(repo: Repo, token: str | None) -> YieldFixture[LocalRepoOperator]:
142142
with filelock.FileLock(BASE_TMP_DIR / "locks" / repo.name):
143143
op = repo.to_op(repo.name, token)
144+
if op is None:
145+
pytest.skip("Could not create repo operator - skipping test")
144146
yield op
145147

146148

0 commit comments

Comments
 (0)