[store_yaml] Simplify: packages records remote sources, single tree walker, dict-style test packages

This commit is contained in:
J. Nick Koston
2026-07-25 16:46:04 -10:00
parent 8e8aac8fcb
commit 49898359be
13 changed files with 144 additions and 149 deletions
+4 -4
View File
@@ -10,6 +10,7 @@ import logging
import os
from pathlib import Path
import platform
import re
import signal
import socket
import subprocess
@@ -178,10 +179,9 @@ async def yaml_config(request: pytest.FixtureRequest, unused_tcp_port: int) -> s
loop = asyncio.get_running_loop()
content = await loop.run_in_executor(None, fixture_path.read_text)
# Replace the port in the config if it contains api section
if "api:" in content:
# Add port configuration after api:
content = content.replace("api:", f"api:\n port: {unused_tcp_port}")
# Replace the port in the config if it contains an api section. Anchored to
# the start of a line so keys that merely end in "api:" are left alone.
content = re.sub(r"(?m)^api:", f"api:\n port: {unused_tcp_port}", content)
# Add debug build flags for integration tests to enable assertions
if "esphome:" in content and "platformio_options:" not in content:
@@ -19,12 +19,8 @@ import contextlib
import pytest
try:
from compression import zstd # type: ignore[import-not-found]
except ImportError:
from backports import zstd # type: ignore[import-not-found, no-redef]
from esphome.components.store_yaml import unpack_envelope
# The component resolves the stdlib-vs-backport zstd import once; reuse it.
from esphome.components.store_yaml import unpack_envelope, zstd
from esphome.yaml_util import find_secret_references
from .types import RunCompiledFunction