Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ucode/databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def _run_databricks_cli_installer(brew_subcommand: str = "install") -> None:
timeout=240,
)
elif system == "Darwin" and shutil.which("brew"):
run(["brew", brew_subcommand, "databricks"], timeout=240)
run(["brew", brew_subcommand, "databricks/tap/databricks"], timeout=240)
elif shutil.which("curl"):
run(["sh", "-c", f"curl -fsSL {UNIX_DATABRICKS_INSTALL_URL} | sudo sh"], timeout=240)
elif shutil.which("wget"):
Expand Down
17 changes: 17 additions & 0 deletions tests/test_databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
AI_GATEWAY_V2_DOCS_URL,
_format_subprocess_result,
_parse_databricks_cli_version,
_run_databricks_cli_installer,
_scrub_databrickscfg,
_scrub_json,
build_auth_shell_command,
Expand Down Expand Up @@ -804,6 +805,22 @@ def test_raises_when_version_unparseable(self, tmp_path, monkeypatch):
ensure_databricks_cli_version()


class TestRunDatabricksCliInstaller:
@pytest.mark.parametrize("brew_subcommand", ["install", "upgrade"])
def test_macos_uses_fully_qualified_tap_formula(self, monkeypatch, brew_subcommand):
calls = []
monkeypatch.setattr(db_mod.platform, "system", lambda: "Darwin")
monkeypatch.setattr(db_mod.shutil, "which", lambda cmd: "/opt/homebrew/bin/brew")
monkeypatch.setattr(db_mod, "run", lambda cmd, **kw: calls.append(cmd))

_run_databricks_cli_installer(brew_subcommand=brew_subcommand)

# The fully-qualified formula forces Homebrew to the Databricks CLI in
# databricks/tap and fails if absent, rather than falling back to the
# unrelated `databricks` cask.
assert calls == [["brew", brew_subcommand, "databricks/tap/databricks"]]


class TestIsUsageTableAccessError:
"""Pin which `ServerOperationError` strings trigger the friendly
`system.ai_gateway.usage` permissions hint vs. fall through to the
Expand Down
Loading