1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-11 07:42:26 +01:00
Files
esphome/tests/integration/test_loop_disable_enable_basic.py
J. Nick Koston 80a8f1437e tests
2025-06-15 19:38:13 -05:00

38 lines
1.2 KiB
Python

"""Basic integration test to verify loop disable/enable compiles."""
from __future__ import annotations
import pytest
from .types import APIClientConnectedFactory, RunCompiledFunction
@pytest.mark.asyncio
async def test_loop_disable_enable_compiles(
yaml_config: str,
run_compiled: RunCompiledFunction,
api_client_connected: APIClientConnectedFactory,
) -> None:
"""Test that components with loop disable/enable compile and run."""
# Get the absolute path to the external components directory
from pathlib import Path
external_components_path = str(
Path(__file__).parent / "fixtures" / "external_components"
)
# Replace the placeholder in the YAML config with the actual path
yaml_config = yaml_config.replace(
"EXTERNAL_COMPONENT_PATH", external_components_path
)
# Write, compile and run the ESPHome device, then connect to API
async with run_compiled(yaml_config), api_client_connected() as client:
# Verify we can get device info
device_info = await client.device_info()
assert device_info is not None
assert device_info.name == "loop-test"
# If we get here, the code compiled and ran successfully
# The partitioned vector implementation is working