diff --git a/script/helpers.py b/script/helpers.py index c75bee35b23..d06a2a327c0 100644 --- a/script/helpers.py +++ b/script/helpers.py @@ -162,8 +162,8 @@ def parse_component_metadata(name: str) -> ComponentMetadata: if not init_file.exists(): return ComponentMetadata() try: - tree = ast.parse(init_file.read_text()) - except (OSError, SyntaxError): + tree = ast.parse(init_file.read_text(encoding="utf-8")) + except (OSError, SyntaxError, UnicodeError): return ComponentMetadata() fields: dict[str, frozenset[str]] = { "AUTO_LOAD": frozenset(), diff --git a/tests/integration/test_uart_mock_ld2412.py b/tests/integration/test_uart_mock_ld2412.py index 12aa3f8397c..ea2ec38b2a3 100644 --- a/tests/integration/test_uart_mock_ld2412.py +++ b/tests/integration/test_uart_mock_ld2412.py @@ -325,9 +325,13 @@ async def test_uart_mock_ld2412_engineering_truncated( ], ) - # Signal when we see Phase 3 recovery values (gate_0_move=50) + # Signal when we see ALL Phase 3 recovery values to avoid race where some + # arrive after the waiter fires but before we index into the lists recovery_received = collector.add_waiter( - lambda: pytest.approx(50.0) in collector.sensor_states["gate_0_move_energy"] + lambda: ( + pytest.approx(50.0) in collector.sensor_states["gate_0_move_energy"] + and pytest.approx(42.0) in collector.sensor_states["light"] + ) ) async with (