Skip to content

Commit 3b18821

Browse files
julienldclaude
andcommitted
fix(tests): Improve HACS unavailability detection for rate limits
**Problem:** - `test_install_mcp_tools_basic` was failing with INTERNAL_ERROR when GitHub rate limited - Other HACS tests were properly skipped with "rate_limit" detection - The `is_hacs_unavailable()` helper didn't recognize nested error dicts or INTERNAL_ERROR + rate limit **Solution:** - Handle nested error dict structure: `{'code': 'INTERNAL_ERROR', 'message': '...'}` - Add detection for `INTERNAL_ERROR` combined with "rate" or "github" keywords - Add broader "rate limit" text detection **Impact:** - HACS tests will now properly skip when GitHub rate limits occur - Reduces flaky test failures in CI - Consistent with how other HACS tests handle rate limiting Fixes the failing CI check on ubuntu-latest. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f86f013 commit 3b18821

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

tests/src/e2e/workflows/hacs/test_hacs.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,22 @@ def is_hacs_unavailable(data: dict) -> tuple[bool, str]:
4545
"""
4646
error = data.get("error", "")
4747
error_code = data.get("error_code", "")
48+
error_str = str(error).lower()
49+
50+
# Handle nested error dict structure
51+
if isinstance(error, dict):
52+
error_code = error.get("code", error_code)
53+
error_str = str(error.get("message", "")).lower()
4854

4955
unavailable_indicators = [
5056
(error_code == "HACS_NOT_AVAILABLE", "HACS not available"),
5157
(error_code == "HACS_DISABLED", f"HACS disabled: {data.get('disabled_reason', 'unknown')}"),
52-
("not found" in str(error).lower(), "Command not found"),
53-
("unknown command" in str(error).lower(), "Unknown command"),
54-
("disabled" in str(error).lower(), "HACS disabled"),
58+
(error_code == "INTERNAL_ERROR" and "rate" in error_str, "GitHub rate limit"),
59+
(error_code == "INTERNAL_ERROR" and "github" in error_str, "GitHub access issue"),
60+
("not found" in error_str, "Command not found"),
61+
("unknown command" in error_str, "Unknown command"),
62+
("disabled" in error_str, "HACS disabled"),
63+
("rate" in error_str and "limit" in error_str, "GitHub rate limit"),
5564
("401" in str(error), "GitHub authentication failed"),
5665
]
5766

0 commit comments

Comments
 (0)