1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 00:31:58 +00:00

Bump ruff from 0.14.14 to 0.15.0 (#13752)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
This commit is contained in:
dependabot[bot]
2026-02-04 09:24:05 +00:00
committed by GitHub
parent 2541ec1565
commit 4d05cd3059
15 changed files with 60 additions and 65 deletions

View File

@@ -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)

View File

@@ -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 ""
)
@@ -1574,8 +1574,8 @@ def test_copy_src_tree_writes_build_info_files(
mock_component.resources = mock_resources
# Setup mocks
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
mock_core.relative_src_path.side_effect = src_path.joinpath
mock_core.relative_build_path.side_effect = build_path.joinpath
mock_core.defines = []
mock_core.config_hash = 0xDEADBEEF
mock_core.comment = "Test comment"
@@ -1649,8 +1649,8 @@ def test_copy_src_tree_detects_config_hash_change(
build_info_h_path.write_text("// old build_info_data.h")
# Setup mocks
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
mock_core.relative_src_path.side_effect = src_path.joinpath
mock_core.relative_build_path.side_effect = build_path.joinpath
mock_core.defines = []
mock_core.config_hash = 0xDEADBEEF # Different from existing
mock_core.comment = ""
@@ -1711,8 +1711,8 @@ def test_copy_src_tree_detects_version_change(
build_info_h_path.write_text("// old build_info_data.h")
# Setup mocks
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
mock_core.relative_src_path.side_effect = src_path.joinpath
mock_core.relative_build_path.side_effect = build_path.joinpath
mock_core.defines = []
mock_core.config_hash = 0xDEADBEEF
mock_core.comment = ""
@@ -1761,8 +1761,8 @@ def test_copy_src_tree_handles_invalid_build_info_json(
build_info_h_path.write_text("// old build_info_data.h")
# Setup mocks
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
mock_core.relative_src_path.side_effect = src_path.joinpath
mock_core.relative_build_path.side_effect = build_path.joinpath
mock_core.defines = []
mock_core.config_hash = 0xDEADBEEF
mock_core.comment = ""
@@ -1835,8 +1835,8 @@ def test_copy_src_tree_build_info_timestamp_behavior(
mock_component.resources = mock_resources
# Setup mocks
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
mock_core.relative_src_path.side_effect = src_path.joinpath
mock_core.relative_build_path.side_effect = build_path.joinpath
mock_core.defines = []
mock_core.config_hash = 0xDEADBEEF
mock_core.comment = ""
@@ -1930,8 +1930,8 @@ def test_copy_src_tree_detects_removed_source_file(
existing_file.write_text("// test file")
# Setup mocks - no components, so the file should be removed
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
mock_core.relative_src_path.side_effect = src_path.joinpath
mock_core.relative_build_path.side_effect = build_path.joinpath
mock_core.defines = []
mock_core.config_hash = 0xDEADBEEF
mock_core.comment = ""
@@ -1992,8 +1992,8 @@ def test_copy_src_tree_ignores_removed_generated_file(
build_info_h.write_text("// old generated file")
# Setup mocks
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
mock_core.relative_src_path.side_effect = src_path.joinpath
mock_core.relative_build_path.side_effect = build_path.joinpath
mock_core.defines = []
mock_core.config_hash = 0xDEADBEEF
mock_core.comment = ""