mirror of
https://github.com/esphome/esphome.git
synced 2026-09-30 00:10:22 +00:00
Reject unsupported CLI toolchains on every platform and complete the native CI triggers
This commit is contained in:
@@ -131,6 +131,20 @@ def test_esp32_rejects_unsupported_toolchains(
|
||||
CONFIG_SCHEMA({"variant": VARIANT_ESP32, "toolchain": config_toolchain})
|
||||
|
||||
|
||||
def test_esp32_rejects_unsupported_cli_toolchain(
|
||||
set_core_config: SetCoreConfigCallable,
|
||||
) -> None:
|
||||
"""A --toolchain the platform cannot serve fails instead of silently
|
||||
building with PlatformIO (the CLI path bypasses the YAML validator)."""
|
||||
set_core_config(PlatformFramework.ESP32_IDF)
|
||||
|
||||
from esphome.components.esp32 import CONFIG_SCHEMA
|
||||
|
||||
CORE.toolchain = Toolchain.ARDUINO
|
||||
with pytest.raises(cv.Invalid, match="Unsupported toolchain 'arduino'"):
|
||||
CONFIG_SCHEMA({"variant": VARIANT_ESP32})
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("config", "error_match"),
|
||||
[
|
||||
|
||||
@@ -3086,6 +3086,8 @@ def test_esp8266_native_components_full_list_on_infra_change() -> None:
|
||||
# Top-level esphome/*.py modules the backend imports directly
|
||||
["esphome/framework_helpers.py"],
|
||||
["esphome/writer.py"],
|
||||
# ccache_path imports from platformio/toolchain.py
|
||||
["esphome/platformio/toolchain.py"],
|
||||
):
|
||||
with (
|
||||
patch.object(determine_jobs, "changed_files", return_value=changed),
|
||||
|
||||
@@ -531,3 +531,14 @@ def testget_tools_path_default_is_global_cache(
|
||||
Path(platformdirs.user_cache_dir("esphome", appauthor=False)) / "sdk-nrf"
|
||||
).resolve()
|
||||
assert get_sdk_nrf_tools_path() == expected
|
||||
|
||||
|
||||
def test_resolve_toolchain_rejects_unsupported() -> None:
|
||||
"""A --toolchain nRF52 cannot serve fails instead of degrading silently."""
|
||||
from esphome.components.nrf52 import _resolve_toolchain
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import Toolchain
|
||||
|
||||
CORE.toolchain = Toolchain.ARDUINO
|
||||
with pytest.raises(cv.Invalid, match="Unsupported toolchain 'arduino'"):
|
||||
_resolve_toolchain({})
|
||||
|
||||
Reference in New Issue
Block a user