1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2026-04-17 23:33:35 +01:00

Remove blocking I/O added to import_image (#6557)

* Remove blocking I/O added to import_image

* Add scanned modules to extra blockbuster functions

* Use same cast avoidance approach in export_image

* Remove unnecessary local image_writer variable

* Remove unnecessary local image_tar_stream variable

---------

Co-authored-by: Stefan Agner <stefan@agner.ch>
This commit is contained in:
Mike Degatano
2026-02-12 11:37:15 -05:00
committed by GitHub
parent da800b8889
commit 590674ba7c
3 changed files with 53 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
"""Tests for apparmor utility."""
import asyncio
from pathlib import Path
import pytest
@@ -31,13 +32,20 @@ profile test flags=(attach_disconnected,mediate_deleted) {
async def test_valid_apparmor_file():
"""Test a valid apparmor file."""
assert validate_profile("example", get_fixture_path("apparmor_valid.txt"))
assert await asyncio.get_running_loop().run_in_executor(
None, validate_profile, "example", get_fixture_path("apparmor_valid.txt")
)
async def test_apparmor_missing_profile(caplog: pytest.LogCaptureFixture):
"""Test apparmor file missing profile."""
with pytest.raises(AppArmorInvalidError):
validate_profile("example", get_fixture_path("apparmor_no_profile.txt"))
await asyncio.get_running_loop().run_in_executor(
None,
validate_profile,
"example",
get_fixture_path("apparmor_no_profile.txt"),
)
assert (
"Missing AppArmor profile inside file: apparmor_no_profile.txt" in caplog.text
@@ -47,7 +55,12 @@ async def test_apparmor_missing_profile(caplog: pytest.LogCaptureFixture):
async def test_apparmor_multiple_profiles(caplog: pytest.LogCaptureFixture):
"""Test apparmor file with too many profiles."""
with pytest.raises(AppArmorInvalidError):
validate_profile("example", get_fixture_path("apparmor_multiple_profiles.txt"))
await asyncio.get_running_loop().run_in_executor(
None,
validate_profile,
"example",
get_fixture_path("apparmor_multiple_profiles.txt"),
)
assert (
"Too many AppArmor profiles inside file: apparmor_multiple_profiles.txt"