mirror of
https://github.com/esphome/esphome.git
synced 2026-10-01 00:40:21 +00:00
Trim comment essays and hoist function-local test imports
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from esphome.components import esp8266
|
||||
from esphome.components.esp8266 import (
|
||||
ARDUINO_FRAMEWORK_SCHEMA,
|
||||
_resolve_toolchain,
|
||||
@@ -120,7 +122,6 @@ def test_decode_pc_native_missing_tools_warns_once(
|
||||
tmp_path: Path, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
"""A stack dump of many addresses produces one missing-tool warning."""
|
||||
from esphome.components import esp8266
|
||||
|
||||
esp8266._DECODE_WARNED_AT.clear()
|
||||
with (
|
||||
@@ -145,9 +146,6 @@ def test_decode_pc_platformio_missing_tools_warns_once(
|
||||
"""The PlatformIO branch reports a missing addr2line/ELF at the same
|
||||
warning level as the native one; raw undecoded addresses with no
|
||||
stated reason are undiagnosable at default log level."""
|
||||
from types import SimpleNamespace
|
||||
|
||||
from esphome.components import esp8266
|
||||
|
||||
esp8266._DECODE_WARNED_AT.clear()
|
||||
CORE.toolchain = Toolchain.PLATFORMIO
|
||||
@@ -161,7 +159,6 @@ def test_decode_pc_platformio_missing_tools_warns_once(
|
||||
|
||||
def test_resolve_toolchain_rejects_unsupported() -> None:
|
||||
"""ESP8266 rejects a CLI toolchain it cannot serve, like every platform."""
|
||||
from esphome.components.esp8266 import _resolve_toolchain
|
||||
|
||||
CORE.toolchain = Toolchain.SDK_NRF
|
||||
with pytest.raises(cv.Invalid, match="Unsupported toolchain 'sdk-nrf'"):
|
||||
|
||||
@@ -23,6 +23,7 @@ from esphome.__main__ import (
|
||||
Purpose,
|
||||
_get_configured_xtal_freq,
|
||||
_make_crystal_freq_callback,
|
||||
_native_toolchain_module,
|
||||
_redact_with_legacy_fallback,
|
||||
_resolve_network_devices,
|
||||
_split_network_devices,
|
||||
@@ -7341,8 +7342,6 @@ def test_compile_program_espidf_idedata_none_warns(
|
||||
def test_native_toolchain_module_missing_hook_raises(tmp_path: Path) -> None:
|
||||
"""A resolved native toolchain whose platform lacks the hook is a bug
|
||||
and must fail, not silently degrade to the PlatformIO path."""
|
||||
from esphome.__main__ import _native_toolchain_module
|
||||
|
||||
setup_core(platform=PLATFORM_ESP32, tmp_path=tmp_path, name="test_device")
|
||||
CORE.toolchain = Toolchain.ARDUINO # esp32 provides no hook
|
||||
with pytest.raises(EsphomeError, match="no native toolchain module"):
|
||||
|
||||
Reference in New Issue
Block a user