Skip to content
Merged
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
24 changes: 12 additions & 12 deletions .build-constraints.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
hatchling==1.29.0 \
--hash=sha256:50af9343281f34785fab12da82e445ed987a6efb34fd8c2fc0f6e6630dbcc1b0 \
--hash=sha256:793c31816d952cee405b83488ce001c719f325d9cda69f1fc4cd750527640ea6
packaging==26.0 \
--hash=sha256:00243ae351a257117b6a241061796684b084ed1c516a08c48a3f7e147a9d80b4 \
--hash=sha256:b36f1fef9334a5588b4166f8bcd26a14e521f2b55e6b9de3aaa80d3ff7a37529
hatchling==1.30.1 \
--hash=sha256:161eacafb3c6f91526e92116d21426369f2c36e98c36a864f11a96345ad4ee31 \
--hash=sha256:eee4fd45357f72ebb3d7a42e5d72cfb5e29ed426d79e8836288926c4258d5f2e
packaging==26.2 \
--hash=sha256:5fc45236b9446107ff2415ce77c807cee2862cb6fac22b8a73826d0693b0980e \
--hash=sha256:ff452ff5a3e828ce110190feff1178bb1f2ea2281fa2075aadb987c2fb221661
# via hatchling
pathspec==1.0.4 \
--hash=sha256:0210e2ae8a21a9137c0d470578cb0e595af87edaa6ebf12ff176f14a02e0e645 \
--hash=sha256:fb6ae2fd4e7c921a165808a552060e722767cfa526f99ca5156ed2ce45a5c723
pathspec==1.1.1 \
--hash=sha256:17db5ecd524104a120e173814c90367a96a98d07c45b2e10c2f3919fff91bf5a \
--hash=sha256:a00ce642f577bf7f473932318056212bc4f8bfdf53128c78bbd5af0b9b20b189
# via hatchling
pluggy==1.6.0 \
--hash=sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3 \
Expand Down Expand Up @@ -62,7 +62,7 @@ tomli==2.4.1 ; python_full_version < '3.11' \
--hash=sha256:ff18e6a727ee0ab0388507b89d1bc6a22b138d1e2fa56d1ad494586d61d2eae9 \
--hash=sha256:ff2983983d34813c1aeb0fa89091e76c3a22889ee83ab27c5eeb45100560c049
# via hatchling
trove-classifiers==2026.1.14.14 \
--hash=sha256:00492545a1402b09d4858605ba190ea33243d361e2b01c9c296ce06b5c3325f3 \
--hash=sha256:1f9553927f18d0513d8e5ff80ab8980b8202ce37ecae0e3274ed2ef11880e74d
trove-classifiers==2026.6.1.19 \
--hash=sha256:ab4c4ec93cc4a4e7815fa759906e05e6bb3f2fbd92ea0f897288c6a43efd15b3 \
--hash=sha256:c5132b4b61a829d11cfbd2d72e97f20a45ed6edb95e45c5efdeb5e00836b2745
# via hatchling
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
all: clean lint fmt test coverage

# Ensure that all uv commands don't automatically update the lock file. If UV_FROZEN=1 (from the environment)
# then UV_LOCKED should _not_ be set, but otherwise it needs to be set to ensure the lock-file is only ever
# deliberately updated.
ifneq ($(UV_FROZEN),1)
export UV_LOCKED := 1
endif
# Ensure that all uv commands don't automatically update the lock file: instead they use the locked dependencies.
export UV_FROZEN := 1
# Ensure that hatchling is pinned when builds are needed.
export UV_BUILD_CONSTRAINT := .build-constraints.txt

Expand Down Expand Up @@ -45,12 +41,17 @@ coverage:
build:
uv build --require-hashes --build-constraints=.build-constraints.txt

lock-dependencies: UV_LOCKED := 0
lock-dependencies: UV_FROZEN := 0
lock-dependencies:
uv lock
uv lock --upgrade
$(UV_RUN) --group yq tomlq -r '.["build-system"].requires[]' pyproject.toml | \
uv pip compile --generate-hashes --universal --no-header - > build-constraints-new.txt
uv pip compile --upgrade --generate-hashes --universal --no-header --quiet - > build-constraints-new.txt
mv build-constraints-new.txt .build-constraints.txt
@perl -pi \
-e 's|registry = "https://[^"]*"|registry = "https://pypi.org/simple"|g;' \
-e 's|url = "https://[^"]*/packages/([^"]*)"|url = "https://files.pythonhosted.org/packages/$$1"|g;' \
uv.lock
@printf 'Stripped registry references from uv.lock.\n'

.DEFAULT: all
.PHONY: all clean dev lint fmt test integration coverage build lock-dependencies
16 changes: 16 additions & 0 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
import pytest

from databricks.sdk.config import Config

pytest_plugins = ['pytester']


@pytest.fixture
def db_config_no_side_effect(monkeypatch: pytest.MonkeyPatch) -> None:
"""Suspend host metadata lookups from the SDKs Config class.

As of version 0.102.0 of the Databricks SDK, the `Config` class during __init__() makes a network call with a
timeout of 5 minutes if the target host does not exist. For unit tests, it never does. This fixture therefore
patches over that lookup to ensure it doesn't get in the way of our tests.
"""

monkeypatch.setattr(Config, "_resolve_host_metadata", lambda _: None)
2 changes: 1 addition & 1 deletion tests/unit/fixtures/test_baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from databricks.labs.pytester.fixtures.sql import sql_backend


def test_ws() -> None:
def test_ws(db_config_no_side_effect: None) -> None:
debug_env = {'DATABRICKS_HOST': 'abc', 'DATABRICKS_TOKEN': '...'}
product_info = 'a', '0.1.2'
workspace_client = call_fixture(ws, debug_env, product_info)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/fixtures/test_iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_make_user_no_args() -> None:
ctx['ws'].users.delete.assert_called_once()


def test_make_run_as_no_args() -> None:
def test_make_run_as_no_args(db_config_no_side_effect: None) -> None:
ctx, run_as = call_stateful(make_run_as)
assert ctx is not None
assert run_as is not None
Expand Down
Loading
Loading