Skip to content

Commit 21c2a2a

Browse files
Gayathri Srividya Rajavarapuclaude
authored andcommitted
fix: add .python-version to rat-excludes and mock DefaultAzureCredential in test
- Add .python-version to dev/.rat-excludes to fix Apache RAT license check (config files like .python-version don't carry ASF headers) - Fix Entra edge-case test: mock DefaultAzureCredential so it doesn't attempt real auth during catalog construction; DefaultAzureCredential does not accept explicit client_id/client_secret/tenant_id kwargs in all library versions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7886e21 commit 21c2a2a

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

dev/.rat-excludes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.github/**
22
dev/.rat-excludes
33
uv.lock
4+
.python-version
45
.ruff_cache/**
56
.pytest_cache/**
67
.mypy_cache/**

tests/catalog/test_rest.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import base64
2121
import json
2222
import os
23+
import time
2324
from collections.abc import Callable
2425
from typing import Any, cast
2526
from unittest import mock
@@ -3390,11 +3391,17 @@ def test_rest_catalog_with_flat_properties_edge_cases(
33903391
mock_load_creds.assert_called_with("/fake/path.json", scopes=expected_scopes)
33913392
elif catalog_properties["auth.type"] == "entra":
33923393
pytest.importorskip("azure.identity", reason="azure-identity is required for Entra auth tests")
3393-
# Just check that the catalog can be constructed and scopes are passed
3394-
rest_mock.get(
3395-
f"{TEST_URI}v1/config",
3396-
json={"defaults": {}, "overrides": {}},
3397-
status_code=200,
3398-
)
3399-
catalog = RestCatalog("rest", **catalog_properties)
3400-
assert catalog.uri == TEST_URI
3394+
# Mock DefaultAzureCredential so we don't try to authenticate for real;
3395+
# DefaultAzureCredential does not accept explicit client_id/secret/tenant kwargs.
3396+
with mock.patch("azure.identity.DefaultAzureCredential") as mock_cred:
3397+
mock_token = mock.MagicMock()
3398+
mock_token.token = "entra_token"
3399+
mock_token.expires_on = time.time() + 3600
3400+
mock_cred.return_value.get_token.return_value = mock_token
3401+
rest_mock.get(
3402+
f"{TEST_URI}v1/config",
3403+
json={"defaults": {}, "overrides": {}},
3404+
status_code=200,
3405+
)
3406+
catalog = RestCatalog("rest", **catalog_properties)
3407+
assert catalog.uri == TEST_URI

0 commit comments

Comments
 (0)