mirror of
https://github.com/esphome/esphome.git
synced 2026-10-06 19:06:37 +00:00
Suppress both restart on_scan_end sweeps; scope the window error path; test the no-effect warning
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user