mirror of
https://github.com/esphome/esphome.git
synced 2026-09-24 13:34:07 +00:00
[pre-commit.ci lite] apply automatic fixes
This commit is contained in:
@@ -453,11 +453,14 @@ def test_preload_core_config_no_platform(setup_core: Path) -> None:
|
||||
# Mock _is_target_platform to avoid expensive component loading
|
||||
with patch("esphome.core.config._is_target_platform") as mock_is_platform:
|
||||
# Return True for known platforms
|
||||
mock_is_platform.side_effect = lambda name: name in [
|
||||
"esp32",
|
||||
"esp8266",
|
||||
"rp2040",
|
||||
]
|
||||
mock_is_platform.side_effect = lambda name: (
|
||||
name
|
||||
in [
|
||||
"esp32",
|
||||
"esp8266",
|
||||
"rp2040",
|
||||
]
|
||||
)
|
||||
|
||||
with pytest.raises(cv.Invalid, match="Platform missing"):
|
||||
preload_core_config(config, result)
|
||||
@@ -477,11 +480,14 @@ def test_preload_core_config_multiple_platforms(setup_core: Path) -> None:
|
||||
# Mock _is_target_platform to avoid expensive component loading
|
||||
with patch("esphome.core.config._is_target_platform") as mock_is_platform:
|
||||
# Return True for known platforms
|
||||
mock_is_platform.side_effect = lambda name: name in [
|
||||
"esp32",
|
||||
"esp8266",
|
||||
"rp2040",
|
||||
]
|
||||
mock_is_platform.side_effect = lambda name: (
|
||||
name
|
||||
in [
|
||||
"esp32",
|
||||
"esp8266",
|
||||
"rp2040",
|
||||
]
|
||||
)
|
||||
|
||||
with pytest.raises(cv.Invalid, match="Found multiple target platform blocks"):
|
||||
preload_core_config(config, result)
|
||||
|
||||
@@ -466,8 +466,8 @@ def test_clean_build(
|
||||
) as mock_get_instance:
|
||||
mock_config = MagicMock()
|
||||
mock_get_instance.return_value = mock_config
|
||||
mock_config.get.side_effect = (
|
||||
lambda section, option: str(platformio_cache_dir)
|
||||
mock_config.get.side_effect = lambda section, option: (
|
||||
str(platformio_cache_dir)
|
||||
if (section, option) == ("platformio", "cache_dir")
|
||||
else ""
|
||||
)
|
||||
@@ -630,8 +630,8 @@ def test_clean_build_empty_cache_dir(
|
||||
) as mock_get_instance:
|
||||
mock_config = MagicMock()
|
||||
mock_get_instance.return_value = mock_config
|
||||
mock_config.get.side_effect = (
|
||||
lambda section, option: " " # Whitespace only
|
||||
mock_config.get.side_effect = lambda section, option: (
|
||||
" " # Whitespace only
|
||||
if (section, option) == ("platformio", "cache_dir")
|
||||
else ""
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user