1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2026-05-08 08:58:31 +01: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:
Mike Degatano
2025-03-04 05:45:44 -05:00
committed by GitHub
parent c01d788c4c
commit 582b128ad9
15 changed files with 104 additions and 69 deletions
+2 -2
View File
@@ -87,13 +87,13 @@ def test_hide_virtual_device(coresys: CoreSys):
assert coresys.hardware.helper.hide_virtual_device(udev_device)
def test_last_boot_error(coresys: CoreSys, caplog: LogCaptureFixture):
async def test_last_boot_error(coresys: CoreSys, caplog: LogCaptureFixture):
"""Test error reading last boot."""
with patch(
"supervisor.hardware.helper.Path.read_text", side_effect=(err := OSError())
):
err.errno = errno.EBADMSG
assert coresys.hardware.helper.last_boot is None
assert await coresys.hardware.helper.last_boot() is None
assert coresys.core.healthy is True
assert "Can't read stat data" in caplog.text