mirror of
https://github.com/esphome/esphome.git
synced 2025-10-12 14:53:49 +01:00
uart grouping
This commit is contained in:
@@ -33,6 +33,8 @@ import sys
|
||||
COMMON_BUS_PATH = Path("tests/test_build_components/common")
|
||||
|
||||
# Valid common bus config directories
|
||||
# All bus types support component grouping for config validation since
|
||||
# --testing-mode bypasses runtime conflicts (we only care that configs compile)
|
||||
VALID_BUS_CONFIGS = {
|
||||
"ble",
|
||||
"i2c",
|
||||
@@ -50,28 +52,6 @@ VALID_BUS_CONFIGS = {
|
||||
"uart_9600_even",
|
||||
}
|
||||
|
||||
# Bus types that support component grouping for config validation
|
||||
# I2C and SPI are shared buses with addressing/CS pins
|
||||
# BLE sensors scan independently and don't conflict
|
||||
# UART is point-to-point but can be grouped for testing since --testing-mode
|
||||
# bypasses the conflict validation (we only care that configs compile)
|
||||
GROUPABLE_BUS_TYPES = {
|
||||
"ble",
|
||||
"i2c",
|
||||
"i2c_low_freq",
|
||||
"qspi",
|
||||
"spi",
|
||||
"uart",
|
||||
"uart_115200",
|
||||
"uart_1200",
|
||||
"uart_1200_even",
|
||||
"uart_19200",
|
||||
"uart_38400",
|
||||
"uart_4800",
|
||||
"uart_4800_even",
|
||||
"uart_9600_even",
|
||||
}
|
||||
|
||||
|
||||
def uses_local_file_references(component_dir: Path) -> bool:
|
||||
"""Check if a component uses local file references via $component_dir.
|
||||
@@ -204,26 +184,26 @@ def create_grouping_signature(
|
||||
"""Create a signature string for grouping components.
|
||||
|
||||
Components with the same signature can be grouped together for testing.
|
||||
Includes groupable bus types (I2C, SPI, BLE, UART) that can be validated
|
||||
together using --testing-mode to bypass runtime conflicts.
|
||||
All valid bus types can be grouped since --testing-mode bypasses runtime
|
||||
conflicts during config validation.
|
||||
|
||||
Args:
|
||||
platform_buses: Mapping of platform to list of buses
|
||||
platform: The specific platform to create signature for
|
||||
|
||||
Returns:
|
||||
Signature string (e.g., "i2c" or "uart") or empty if no groupable buses
|
||||
Signature string (e.g., "i2c" or "uart") or empty if no valid buses
|
||||
"""
|
||||
buses = platform_buses.get(platform, [])
|
||||
if not buses:
|
||||
return ""
|
||||
|
||||
# Only include groupable bus types in signature
|
||||
groupable_buses = [b for b in buses if b in GROUPABLE_BUS_TYPES]
|
||||
if not groupable_buses:
|
||||
# Only include valid bus types in signature
|
||||
valid_buses = [b for b in buses if b in VALID_BUS_CONFIGS]
|
||||
if not valid_buses:
|
||||
return ""
|
||||
|
||||
return "+".join(sorted(groupable_buses))
|
||||
return "+".join(sorted(valid_buses))
|
||||
|
||||
|
||||
def group_components_by_signature(
|
||||
|
@@ -333,11 +333,11 @@ def run_grouped_component_tests(
|
||||
if platform_filter and not platform.startswith(platform_filter):
|
||||
continue
|
||||
|
||||
# Only group if component has groupable bus configs
|
||||
# Only group if component has valid bus configs
|
||||
if buses:
|
||||
signature = create_grouping_signature({platform: buses}, platform)
|
||||
# Only add to grouped_components if signature is non-empty
|
||||
# (empty means component has no groupable bus configurations)
|
||||
# (empty means component has no valid bus configurations)
|
||||
if signature:
|
||||
grouped_components[(platform, signature)].append(component)
|
||||
|
||||
|
Reference in New Issue
Block a user