Fix zha test by tweaking the log level (#115368)
This commit is contained in:
parent
bbecb98927
commit
be8adf9d29
1 changed files with 13 additions and 3 deletions
|
@ -265,17 +265,27 @@ async def test_no_warn_on_socket(hass: HomeAssistant) -> None:
|
|||
mock_probe.assert_not_called()
|
||||
|
||||
|
||||
async def test_probe_failure_exception_handling(caplog) -> None:
|
||||
async def test_probe_failure_exception_handling(
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test that probe failures are handled gracefully."""
|
||||
logger = logging.getLogger(
|
||||
"homeassistant.components.zha.repairs.wrong_silabs_firmware"
|
||||
)
|
||||
orig_level = logger.level
|
||||
|
||||
with (
|
||||
caplog.at_level(logging.DEBUG),
|
||||
patch(
|
||||
"homeassistant.components.zha.repairs.wrong_silabs_firmware.Flasher.probe_app_type",
|
||||
side_effect=RuntimeError(),
|
||||
),
|
||||
caplog.at_level(logging.DEBUG),
|
||||
) as mock_probe_app_type,
|
||||
):
|
||||
logger.setLevel(logging.DEBUG)
|
||||
await probe_silabs_firmware_type("/dev/ttyZigbee")
|
||||
logger.setLevel(orig_level)
|
||||
|
||||
mock_probe_app_type.assert_awaited()
|
||||
assert "Failed to probe application type" in caplog.text
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue