mirror of
https://github.com/esphome/esphome.git
synced 2026-02-08 00:31:58 +00:00
[esp32_ble] include sdkconfig.h before ESP-Hosted preprocessor guards (#13787)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
"""
|
||||
Test schema.extend functionality in esphome.config_validation.
|
||||
Test config_validation functionality in esphome.config_validation.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
from voluptuous import Invalid
|
||||
|
||||
import esphome.config_validation as cv
|
||||
from esphome.core import CORE
|
||||
|
||||
|
||||
def test_config_extend() -> None:
|
||||
@@ -49,3 +53,37 @@ def test_config_extend() -> None:
|
||||
assert validated["key2"] == "initial_value2"
|
||||
assert validated["extra_1"] == "value1"
|
||||
assert validated["extra_2"] == "value2"
|
||||
|
||||
|
||||
def test_requires_component_passes_when_loaded() -> None:
|
||||
"""Test requires_component passes when the required component is loaded."""
|
||||
CORE.loaded_integrations.update({"wifi", "logger"})
|
||||
validator = cv.requires_component("wifi")
|
||||
result = validator("test_value")
|
||||
assert result == "test_value"
|
||||
|
||||
|
||||
def test_requires_component_fails_when_not_loaded() -> None:
|
||||
"""Test requires_component raises Invalid when the required component is not loaded."""
|
||||
CORE.loaded_integrations.add("logger")
|
||||
validator = cv.requires_component("wifi")
|
||||
with pytest.raises(Invalid) as exc_info:
|
||||
validator("test_value")
|
||||
assert "requires component wifi" in str(exc_info.value)
|
||||
|
||||
|
||||
def test_conflicts_with_component_passes_when_not_loaded() -> None:
|
||||
"""Test conflicts_with_component passes when the conflicting component is not loaded."""
|
||||
CORE.loaded_integrations.update({"wifi", "logger"})
|
||||
validator = cv.conflicts_with_component("esp32_hosted")
|
||||
result = validator("test_value")
|
||||
assert result == "test_value"
|
||||
|
||||
|
||||
def test_conflicts_with_component_fails_when_loaded() -> None:
|
||||
"""Test conflicts_with_component raises Invalid when the conflicting component is loaded."""
|
||||
CORE.loaded_integrations.update({"wifi", "esp32_hosted"})
|
||||
validator = cv.conflicts_with_component("esp32_hosted")
|
||||
with pytest.raises(Invalid) as exc_info:
|
||||
validator("test_value")
|
||||
assert "not compatible with component esp32_hosted" in str(exc_info.value)
|
||||
|
||||
Reference in New Issue
Block a user