From 95d43ea29f2bc4180155b401984fb03a965ecc99 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 5 Aug 2026 19:57:12 -0500 Subject: [PATCH 1/2] Mention Python benchmarks in should_run_benchmarks docstring --- script/determine-jobs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/determine-jobs.py b/script/determine-jobs.py index 2f1c16a23c..a9c7b06360 100755 --- a/script/determine-jobs.py +++ b/script/determine-jobs.py @@ -658,7 +658,7 @@ BENCHMARK_INFRASTRUCTURE_FILES = frozenset( def should_run_benchmarks(branch: str | None = None) -> bool: - """Determine if C++ benchmarks should run based on changed files. + """Determine if benchmarks (C++ and Python) should run based on changed files. Benchmarks run when any of the following conditions are met: From 53e229cd4f265098dbb89a9e8171e5721233c351 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 5 Aug 2026 19:57:43 -0500 Subject: [PATCH 2/2] Test the CLI wiring for snapshot_user_config --- tests/unit_tests/test_main.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/unit_tests/test_main.py b/tests/unit_tests/test_main.py index 556bac9ee5..6c13cd5f12 100644 --- a/tests/unit_tests/test_main.py +++ b/tests/unit_tests/test_main.py @@ -6362,6 +6362,26 @@ def test_run_esphome_skip_external_update_per_command( assert mock_read.call_args.kwargs["skip_external_update"] is expected_skip +@pytest.mark.parametrize( + ("argv_extra", "expected"), + [(["--no-defaults"], True), ([], False)], +) +def test_run_esphome_snapshot_user_config_only_for_no_defaults( + tmp_path: Path, argv_extra: list[str], expected: bool +) -> None: + """read_config is invoked with snapshot_user_config=True only when the + config command is run with --no-defaults; otherwise the expensive deep + copy is skipped.""" + yaml_file = tmp_path / "device.yaml" + yaml_file.write_text("esphome:\n name: test\n") + + with patch("esphome.config.read_config", return_value=None) as mock_read: + run_esphome(["esphome", "config", str(yaml_file), *argv_extra]) + + mock_read.assert_called_once() + assert mock_read.call_args.kwargs["snapshot_user_config"] is expected + + def test_get_configured_xtal_freq_reads_sdkconfig(tmp_path: Path) -> None: """Test reading XTAL_FREQ from sdkconfig.""" CORE.name = "test-device"