1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Fix test_before_setup IQS check (#162187)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
epenet
2026-02-04 12:41:59 +01:00
committed by GitHub
parent 45c7b9ccb8
commit b633b8d271

View File

@@ -33,6 +33,11 @@ def _get_exception_name(expression: ast.expr) -> str:
# Raise namespace.???
return _get_exception_name(expression.value)
if isinstance(expression, ast.Subscript):
# Raise errors[0][0]
# Unable to determine exception name
return None
raise AssertionError(
f"Raise is neither Attribute nor Call nor Name: {type(expression)}"
)
@@ -40,7 +45,8 @@ def _get_exception_name(expression: ast.expr) -> str:
def _raises_exception(integration: Integration) -> bool:
"""Check that a valid exception is raised."""
for module_file in integration.path.rglob("*.py"):
# Sorted to ensure reproducible checks
for module_file in sorted(integration.path.rglob("*.py")):
module = ast_parse_module(module_file)
for node in ast.walk(module):
if (