From 82692d7053ec4713a4eadb802ec33619d91ce57f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 10 Nov 2025 19:00:54 -0600 Subject: [PATCH] [tests] Migrate components to shared packages and fix ID ambiguity (#11819) --- script/analyze_component_buses.py | 1 + tests/components/chsc6x/test.rp2040-ard.yaml | 1 + tests/components/hlk_fm22x/common.yaml | 41 ++++++++++++++++ .../components/hlk_fm22x/test.esp32-idf.yaml | 49 ++----------------- .../hlk_fm22x/test.esp8266-ard.yaml | 49 ++----------------- .../components/hlk_fm22x/test.rp2040-ard.yaml | 49 ++----------------- tests/components/speaker/common.yaml | 30 +++++++++--- tests/components/toshiba/common_ras2819t.yaml | 8 --- .../toshiba/test_ras2819t.esp32-ard.yaml | 6 +-- .../toshiba/test_ras2819t.esp32-c3-ard.yaml | 6 +-- .../toshiba/test_ras2819t.esp32-idf.yaml | 6 +-- .../toshiba/test_ras2819t.esp8266-ard.yaml | 6 +-- .../common/remote_receiver/esp32-ard.yaml | 12 +++++ .../common/remote_receiver/esp32-c3-ard.yaml | 12 +++++ 14 files changed, 111 insertions(+), 165 deletions(-) create mode 100644 tests/components/hlk_fm22x/common.yaml create mode 100644 tests/test_build_components/common/remote_receiver/esp32-ard.yaml create mode 100644 tests/test_build_components/common/remote_receiver/esp32-c3-ard.yaml diff --git a/script/analyze_component_buses.py b/script/analyze_component_buses.py index 38d1f8c2b7..27a36f889f 100755 --- a/script/analyze_component_buses.py +++ b/script/analyze_component_buses.py @@ -86,6 +86,7 @@ ISOLATED_COMPONENTS = { "modbus_controller": "Defines multiple modbus buses for testing client/server functionality - conflicts with package modbus bus", "neopixelbus": "RMT type conflict with ESP32 Arduino/ESP-IDF headers (enum vs struct rmt_channel_t)", "packages": "cannot merge packages", + "tinyusb": "Conflicts with usb_host component - cannot be used together", } diff --git a/tests/components/chsc6x/test.rp2040-ard.yaml b/tests/components/chsc6x/test.rp2040-ard.yaml index 89cc1b7477..2e3613a4a3 100644 --- a/tests/components/chsc6x/test.rp2040-ard.yaml +++ b/tests/components/chsc6x/test.rp2040-ard.yaml @@ -16,5 +16,6 @@ display: touchscreen: - platform: chsc6x + i2c_id: i2c_bus display: ili9xxx_display interrupt_pin: 22 diff --git a/tests/components/hlk_fm22x/common.yaml b/tests/components/hlk_fm22x/common.yaml new file mode 100644 index 0000000000..6fcd9af594 --- /dev/null +++ b/tests/components/hlk_fm22x/common.yaml @@ -0,0 +1,41 @@ +esphome: + on_boot: + then: + - hlk_fm22x.enroll: + name: "Test" + direction: 1 + - hlk_fm22x.delete_all: + +hlk_fm22x: + on_face_scan_matched: + - logger.log: test_hlk_22x_face_scan_matched + on_face_scan_unmatched: + - logger.log: test_hlk_22x_face_scan_unmatched + on_face_scan_invalid: + - logger.log: test_hlk_22x_face_scan_invalid + on_face_info: + - logger.log: test_hlk_22x_face_info + on_enrollment_done: + - logger.log: test_hlk_22x_enrollment_done + on_enrollment_failed: + - logger.log: test_hlk_22x_enrollment_failed + +sensor: + - platform: hlk_fm22x + face_count: + name: "Face Count" + last_face_id: + name: "Last Face ID" + status: + name: "Face Status" + +binary_sensor: + - platform: hlk_fm22x + name: "Face Enrolling" + +text_sensor: + - platform: hlk_fm22x + version: + name: "HLK Version" + last_face_name: + name: "Last Face Name" diff --git a/tests/components/hlk_fm22x/test.esp32-idf.yaml b/tests/components/hlk_fm22x/test.esp32-idf.yaml index 5e7cbde664..2d29656c94 100644 --- a/tests/components/hlk_fm22x/test.esp32-idf.yaml +++ b/tests/components/hlk_fm22x/test.esp32-idf.yaml @@ -1,47 +1,4 @@ -esphome: - on_boot: - then: - - hlk_fm22x.enroll: - name: "Test" - direction: 1 - - hlk_fm22x.delete_all: +packages: + uart: !include ../../test_build_components/common/uart/esp32-idf.yaml -uart: - - id: uart_hlk_fm22x - tx_pin: 17 - rx_pin: 16 - baud_rate: 115200 - -hlk_fm22x: - on_face_scan_matched: - - logger.log: test_hlk_22x_face_scan_matched - on_face_scan_unmatched: - - logger.log: test_hlk_22x_face_scan_unmatched - on_face_scan_invalid: - - logger.log: test_hlk_22x_face_scan_invalid - on_face_info: - - logger.log: test_hlk_22x_face_info - on_enrollment_done: - - logger.log: test_hlk_22x_enrollment_done - on_enrollment_failed: - - logger.log: test_hlk_22x_enrollment_failed - -sensor: - - platform: hlk_fm22x - face_count: - name: "Face Count" - last_face_id: - name: "Last Face ID" - status: - name: "Face Status" - -binary_sensor: - - platform: hlk_fm22x - name: "Face Enrolling" - -text_sensor: - - platform: hlk_fm22x - version: - name: "HLK Version" - last_face_name: - name: "Last Face Name" +<<: !include common.yaml diff --git a/tests/components/hlk_fm22x/test.esp8266-ard.yaml b/tests/components/hlk_fm22x/test.esp8266-ard.yaml index 680047834c..5a05efa259 100644 --- a/tests/components/hlk_fm22x/test.esp8266-ard.yaml +++ b/tests/components/hlk_fm22x/test.esp8266-ard.yaml @@ -1,47 +1,4 @@ -esphome: - on_boot: - then: - - hlk_fm22x.enroll: - name: "Test" - direction: 1 - - hlk_fm22x.delete_all: +packages: + uart: !include ../../test_build_components/common/uart/esp8266-ard.yaml -uart: - - id: uart_hlk_fm22x - tx_pin: 4 - rx_pin: 5 - baud_rate: 115200 - -hlk_fm22x: - on_face_scan_matched: - - logger.log: test_hlk_22x_face_scan_matched - on_face_scan_unmatched: - - logger.log: test_hlk_22x_face_scan_unmatched - on_face_scan_invalid: - - logger.log: test_hlk_22x_face_scan_invalid - on_face_info: - - logger.log: test_hlk_22x_face_info - on_enrollment_done: - - logger.log: test_hlk_22x_enrollment_done - on_enrollment_failed: - - logger.log: test_hlk_22x_enrollment_failed - -sensor: - - platform: hlk_fm22x - face_count: - name: "Face Count" - last_face_id: - name: "Last Face ID" - status: - name: "Face Status" - -binary_sensor: - - platform: hlk_fm22x - name: "Face Enrolling" - -text_sensor: - - platform: hlk_fm22x - version: - name: "HLK Version" - last_face_name: - name: "Last Face Name" +<<: !include common.yaml diff --git a/tests/components/hlk_fm22x/test.rp2040-ard.yaml b/tests/components/hlk_fm22x/test.rp2040-ard.yaml index 680047834c..f1df2daf83 100644 --- a/tests/components/hlk_fm22x/test.rp2040-ard.yaml +++ b/tests/components/hlk_fm22x/test.rp2040-ard.yaml @@ -1,47 +1,4 @@ -esphome: - on_boot: - then: - - hlk_fm22x.enroll: - name: "Test" - direction: 1 - - hlk_fm22x.delete_all: +packages: + uart: !include ../../test_build_components/common/uart/rp2040-ard.yaml -uart: - - id: uart_hlk_fm22x - tx_pin: 4 - rx_pin: 5 - baud_rate: 115200 - -hlk_fm22x: - on_face_scan_matched: - - logger.log: test_hlk_22x_face_scan_matched - on_face_scan_unmatched: - - logger.log: test_hlk_22x_face_scan_unmatched - on_face_scan_invalid: - - logger.log: test_hlk_22x_face_scan_invalid - on_face_info: - - logger.log: test_hlk_22x_face_info - on_enrollment_done: - - logger.log: test_hlk_22x_enrollment_done - on_enrollment_failed: - - logger.log: test_hlk_22x_enrollment_failed - -sensor: - - platform: hlk_fm22x - face_count: - name: "Face Count" - last_face_id: - name: "Last Face ID" - status: - name: "Face Status" - -binary_sensor: - - platform: hlk_fm22x - name: "Face Enrolling" - -text_sensor: - - platform: hlk_fm22x - version: - name: "HLK Version" - last_face_name: - name: "Last Face Name" +<<: !include common.yaml diff --git a/tests/components/speaker/common.yaml b/tests/components/speaker/common.yaml index fa54fa7e39..9aaf639162 100644 --- a/tests/components/speaker/common.yaml +++ b/tests/components/speaker/common.yaml @@ -11,26 +11,42 @@ esphome: on_boot: then: - speaker.mute_on: + id: speaker_id - speaker.mute_off: + id: speaker_id - if: - condition: speaker.is_stopped + condition: + speaker.is_stopped: + id: speaker_id then: - - speaker.play: [0, 1, 2, 3] - - speaker.volume_set: 0.9 + - speaker.play: + id: speaker_id + data: [0, 1, 2, 3] + - speaker.volume_set: + id: speaker_id + volume: 0.9 - if: - condition: speaker.is_playing + condition: + speaker.is_playing: + id: speaker_id then: - speaker.finish: + id: speaker_id - speaker.stop: + id: speaker_id button: - platform: template name: "Speaker Button" on_press: then: - - speaker.play: [0x10, 0x20, 0x30, 0x40] - - speaker.play: !lambda |- - return {0x01, 0x02, (uint8_t)id(my_number).state}; + - speaker.play: + id: speaker_id + data: [0x10, 0x20, 0x30, 0x40] + - speaker.play: + id: speaker_id + data: !lambda |- + return {0x01, 0x02, (uint8_t)id(my_number).state}; i2s_audio: i2s_lrclk_pin: ${i2s_bclk_pin} diff --git a/tests/components/toshiba/common_ras2819t.yaml b/tests/components/toshiba/common_ras2819t.yaml index 32081fca98..157456ba81 100644 --- a/tests/components/toshiba/common_ras2819t.yaml +++ b/tests/components/toshiba/common_ras2819t.yaml @@ -1,11 +1,3 @@ -remote_transmitter: - pin: ${tx_pin} - carrier_duty_percent: 50% - -remote_receiver: - id: rcvr - pin: ${rx_pin} - climate: - platform: toshiba name: "RAS-2819T Climate" diff --git a/tests/components/toshiba/test_ras2819t.esp32-ard.yaml b/tests/components/toshiba/test_ras2819t.esp32-ard.yaml index 00805baa01..d82ba54897 100644 --- a/tests/components/toshiba/test_ras2819t.esp32-ard.yaml +++ b/tests/components/toshiba/test_ras2819t.esp32-ard.yaml @@ -1,5 +1,5 @@ -substitutions: - tx_pin: GPIO5 - rx_pin: GPIO4 +packages: + remote_transmitter: !include ../../test_build_components/common/remote_transmitter/esp32-ard.yaml + remote_receiver: !include ../../test_build_components/common/remote_receiver/esp32-ard.yaml <<: !include common_ras2819t.yaml diff --git a/tests/components/toshiba/test_ras2819t.esp32-c3-ard.yaml b/tests/components/toshiba/test_ras2819t.esp32-c3-ard.yaml index 00805baa01..6858dd587f 100644 --- a/tests/components/toshiba/test_ras2819t.esp32-c3-ard.yaml +++ b/tests/components/toshiba/test_ras2819t.esp32-c3-ard.yaml @@ -1,5 +1,5 @@ -substitutions: - tx_pin: GPIO5 - rx_pin: GPIO4 +packages: + remote_transmitter: !include ../../test_build_components/common/remote_transmitter/esp32-ard.yaml + remote_receiver: !include ../../test_build_components/common/remote_receiver/esp32-c3-ard.yaml <<: !include common_ras2819t.yaml diff --git a/tests/components/toshiba/test_ras2819t.esp32-idf.yaml b/tests/components/toshiba/test_ras2819t.esp32-idf.yaml index 00805baa01..3facc5bbb3 100644 --- a/tests/components/toshiba/test_ras2819t.esp32-idf.yaml +++ b/tests/components/toshiba/test_ras2819t.esp32-idf.yaml @@ -1,5 +1,5 @@ -substitutions: - tx_pin: GPIO5 - rx_pin: GPIO4 +packages: + remote_transmitter: !include ../../test_build_components/common/remote_transmitter/esp32-idf.yaml + remote_receiver: !include ../../test_build_components/common/remote_receiver/esp32-idf.yaml <<: !include common_ras2819t.yaml diff --git a/tests/components/toshiba/test_ras2819t.esp8266-ard.yaml b/tests/components/toshiba/test_ras2819t.esp8266-ard.yaml index 00805baa01..3976dcc739 100644 --- a/tests/components/toshiba/test_ras2819t.esp8266-ard.yaml +++ b/tests/components/toshiba/test_ras2819t.esp8266-ard.yaml @@ -1,5 +1,5 @@ -substitutions: - tx_pin: GPIO5 - rx_pin: GPIO4 +packages: + remote_transmitter: !include ../../test_build_components/common/remote_transmitter/esp8266-ard.yaml + remote_receiver: !include ../../test_build_components/common/remote_receiver/esp8266-ard.yaml <<: !include common_ras2819t.yaml diff --git a/tests/test_build_components/common/remote_receiver/esp32-ard.yaml b/tests/test_build_components/common/remote_receiver/esp32-ard.yaml new file mode 100644 index 0000000000..af5c2f2409 --- /dev/null +++ b/tests/test_build_components/common/remote_receiver/esp32-ard.yaml @@ -0,0 +1,12 @@ +# Common remote_receiver configuration for ESP32 Arduino tests +# Provides a shared remote receiver that all components can use +# Components will auto-use this receiver if they don't specify receiver_id + +substitutions: + remote_receiver_pin: GPIO32 + +remote_receiver: + - id: rcvr + pin: ${remote_receiver_pin} + dump: all + tolerance: 25% diff --git a/tests/test_build_components/common/remote_receiver/esp32-c3-ard.yaml b/tests/test_build_components/common/remote_receiver/esp32-c3-ard.yaml new file mode 100644 index 0000000000..26b288b427 --- /dev/null +++ b/tests/test_build_components/common/remote_receiver/esp32-c3-ard.yaml @@ -0,0 +1,12 @@ +# Common remote_receiver configuration for ESP32-C3 Arduino tests +# Provides a shared remote receiver that all components can use +# Components will auto-use this receiver if they don't specify receiver_id + +substitutions: + remote_receiver_pin: GPIO10 + +remote_receiver: + - id: rcvr + pin: ${remote_receiver_pin} + dump: all + tolerance: 25%