Skip to content

Commit f70b032

Browse files
committed
fix: apply ruff formatting and fix QueryFailedError signature in tests
1 parent b3e6e94 commit f70b032

2 files changed

Lines changed: 7 additions & 13 deletions

File tree

src/dbt_mcp/semantic_layer/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@
6565
def _is_platform_credential_error(error_message: str) -> bool:
6666
"""Detect whether an error message indicates expired dbt Cloud platform credentials."""
6767
return any(
68-
pattern.search(error_message)
69-
for pattern in _PLATFORM_CREDENTIAL_ERROR_PATTERNS
68+
pattern.search(error_message) for pattern in _PLATFORM_CREDENTIAL_ERROR_PATTERNS
7069
)
7170

7271

tests/unit/semantic_layer/test_platform_credential_errors.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,18 @@ def test_detects_oauth_token_expired(self) -> None:
5252
)
5353

5454
def test_case_insensitive(self) -> None:
55-
assert _is_platform_credential_error(
56-
"sso AUTHENTICATION Has Expired"
57-
)
55+
assert _is_platform_credential_error("sso AUTHENTICATION Has Expired")
5856

5957
def test_does_not_match_generic_query_error(self) -> None:
60-
assert not _is_platform_credential_error(
61-
"column 'revenue' not found in table"
62-
)
58+
assert not _is_platform_credential_error("column 'revenue' not found in table")
6359

6460
def test_does_not_match_syntax_error(self) -> None:
6561
assert not _is_platform_credential_error(
6662
"SQL compilation error: syntax error at position 42"
6763
)
6864

6965
def test_does_not_match_timeout_error(self) -> None:
70-
assert not _is_platform_credential_error(
71-
"Query timed out after 60 seconds"
72-
)
66+
assert not _is_platform_credential_error("Query timed out after 60 seconds")
7367

7468
def test_does_not_match_empty_string(self) -> None:
7569
assert not _is_platform_credential_error("")
@@ -107,7 +101,7 @@ def test_query_failed_error_with_credential_message_includes_hint(
107101
"""QueryFailedError wrapping a credential expiry should also get the hint."""
108102
error = Exception(
109103
'QueryFailedError(["SSO authentication has expired, '
110-
"please re-connect to Snowflake\"])"
104+
'please re-connect to Snowflake"])'
111105
)
112106
result = fetcher._format_semantic_layer_error(error)
113107
assert "dbt Cloud" in result
@@ -118,7 +112,8 @@ def test_format_query_failed_error_with_credential_message(self, fetcher) -> Non
118112
from dbtsl.error import QueryFailedError
119113

120114
error = QueryFailedError(
121-
"SSO authentication has expired, please re-connect to Snowflake"
115+
message="SSO authentication has expired, please re-connect to Snowflake",
116+
status="FAILED",
122117
)
123118
result = fetcher._format_query_failed_error(error)
124119
assert "dbt Cloud" in result.error

0 commit comments

Comments
 (0)