Suppress both restart on_scan_end sweeps; scope the window error path; test the no-effect warning

This commit is contained in:
J. Nick Koston
2026-08-21 17:54:12 -05:00
parent 90e25f2349
commit 256853210b
5 changed files with 45 additions and 7 deletions
@@ -0,0 +1,14 @@
esphome:
name: scan-window-user-scan-only
esp32:
board: esp32dev
framework:
type: esp-idf
wifi:
ssid: MySSID
esp32_ble_tracker:
scan_parameters:
connection_scan_window: 20ms
@@ -222,3 +222,17 @@ def test_codegen_no_connection_window_without_gatt_clients(
main_cpp = generate_main(component_config_path("scan_window_scan_only.yaml"))
assert "set_scan_window(512)" in main_cpp
assert "set_connection_scan_window" not in main_cpp
def test_user_set_connection_window_warns_without_gatt_clients(
generate_main: Callable[[str | Path], str],
component_config_path: Callable[[str], Path],
caplog: pytest.LogCaptureFixture,
) -> None:
"""A user-set value that cannot take effect warns; the injected default
(previous test) is dropped silently."""
main_cpp = generate_main(
component_config_path("scan_window_user_set_scan_only.yaml")
)
assert "set_connection_scan_window" not in main_cpp
assert "'connection_scan_window' has no effect" in caplog.text