From e299eca19c7cd282a24573da37921ffab1229e49 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 16 Sep 2026 14:04:33 +0200 Subject: [PATCH] Fix flaky FinTS account identifier logging test (#182376) Co-authored-by: Claude Opus 5 (1M context) --- tests/components/fints/test_sensor.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/components/fints/test_sensor.py b/tests/components/fints/test_sensor.py index 26cbce6aef01..72720fbf3201 100644 --- a/tests/components/fints/test_sensor.py +++ b/tests/components/fints/test_sensor.py @@ -96,7 +96,7 @@ async def test_setup_platform( async def test_account_identifiers_are_not_logged( hass: HomeAssistant, mock_bank: MagicMock, caplog: pytest.LogCaptureFixture ) -> None: - """No IBAN or account number ends up in the log.""" + """No IBAN or account number ends up in the log of this integration.""" caplog.set_level(logging.DEBUG) with patch( @@ -106,5 +106,14 @@ async def test_account_identifiers_are_not_logged( assert await async_setup_component(hass, "sensor", CONFIG) await hass.async_block_till_done() + # The identifiers are state attributes, which the event bus dumps as part of + # the state changed events it logs when debug logging is on. Only the log of + # this integration is of interest here. + logged = "\n".join( + record.getMessage() + for record in caplog.records + if record.name.startswith("homeassistant.components.fints") + ) + for identifier in ACCOUNT_TYPES: - assert identifier not in caplog.text + assert identifier not in logged