From 5cf2135038df49deeb2dde4b1c85179145e51587 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 20 Aug 2026 19:29:27 -0500 Subject: [PATCH] Cover the warn-once dedup branch --- tests/unit_tests/test_platformio_extra_script.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/unit_tests/test_platformio_extra_script.py b/tests/unit_tests/test_platformio_extra_script.py index f15f94f0e7..262ab860db 100644 --- a/tests/unit_tests/test_platformio_extra_script.py +++ b/tests/unit_tests/test_platformio_extra_script.py @@ -285,3 +285,15 @@ def test_run_extra_script_syntax_error_is_best_effort(tmp_path, caplog) -> None: ) assert result.libs == [] assert "ignoring its output" in caplog.text + + +def test_unsupported_env_method_warns_once(caplog) -> None: + """Repeated calls to the same unsupported method warn only once.""" + from esphome.platformio.extra_script import _FakeSConsEnv + + env = _FakeSConsEnv( + board_mcu="esp8266", pio_env="esphome_esp8266", pio_platform="espressif8266" + ) + env.Replace(CC="clang") + env.Replace(CC="gcc") + assert caplog.text.count("env.Replace(...) is not supported") == 1