1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Fix unspecified-encoding warnings in tests (#119405)

This commit is contained in:
epenet
2024-06-11 17:58:40 +02:00
committed by GitHub
parent 6bb9011db3
commit 7388271689
15 changed files with 33 additions and 30 deletions

View File

@@ -208,7 +208,7 @@ async def test_protect_loop_open(caplog: pytest.LogCaptureFixture) -> None:
"""Test open of a file in /proc is not reported."""
block_async_io.enable()
with contextlib.suppress(FileNotFoundError):
open("/proc/does_not_exist").close()
open("/proc/does_not_exist", encoding="utf8").close()
assert "Detected blocking call to open with args" not in caplog.text
@@ -216,7 +216,7 @@ async def test_protect_open(caplog: pytest.LogCaptureFixture) -> None:
"""Test opening a file in the event loop logs."""
block_async_io.enable()
with contextlib.suppress(FileNotFoundError):
open("/config/data_not_exist").close()
open("/config/data_not_exist", encoding="utf8").close()
assert "Detected blocking call to open with args" in caplog.text
@@ -233,7 +233,7 @@ async def test_protect_open_path(path: Any, caplog: pytest.LogCaptureFixture) ->
"""Test opening a file by path in the event loop logs."""
block_async_io.enable()
with contextlib.suppress(FileNotFoundError):
open(path).close()
open(path, encoding="utf8").close()
assert "Detected blocking call to open with args" in caplog.text