mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-19 07:50:17 +00:00
Finish migrating read_text to executor (#5698)
* Move read_text to executor * switch to async_capture_exception * Finish moving read_text to executor * Cover read_bytes and some write_text calls as well * Fix await issues * Fix format_message
This commit is contained in:
@@ -66,21 +66,21 @@ async def test_get_users_none(coresys: CoreSys, ha_ws_client: AsyncMock):
|
||||
)
|
||||
|
||||
|
||||
def test_write_pulse_error(coresys: CoreSys, caplog: pytest.LogCaptureFixture):
|
||||
async def test_write_pulse_error(coresys: CoreSys, caplog: pytest.LogCaptureFixture):
|
||||
"""Test errors writing pulse config."""
|
||||
with patch(
|
||||
"supervisor.homeassistant.module.Path.write_text",
|
||||
side_effect=(err := OSError()),
|
||||
):
|
||||
err.errno = errno.EBUSY
|
||||
coresys.homeassistant.write_pulse()
|
||||
await coresys.homeassistant.write_pulse()
|
||||
|
||||
assert "can't write pulse/client.config" in caplog.text
|
||||
assert coresys.core.healthy is True
|
||||
|
||||
caplog.clear()
|
||||
err.errno = errno.EBADMSG
|
||||
coresys.homeassistant.write_pulse()
|
||||
await coresys.homeassistant.write_pulse()
|
||||
|
||||
assert "can't write pulse/client.config" in caplog.text
|
||||
assert coresys.core.healthy is False
|
||||
|
||||
Reference in New Issue
Block a user