1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-12 14:53:49 +01:00
This commit is contained in:
J. Nick Koston
2025-10-08 17:02:52 -10:00
parent 073f779cea
commit 2459c40bce
2 changed files with 27 additions and 4 deletions

View File

@@ -50,6 +50,18 @@ VALID_BUS_CONFIGS = {
"uart_9600_even", "uart_9600_even",
} }
# Bus types that support component grouping
# I2C and SPI are shared buses with addressing/CS pins
# BLE sensors scan independently and don't conflict
# UART is point-to-point and components would conflict on the same bus
GROUPABLE_BUS_TYPES = {
"ble",
"i2c",
"i2c_low_freq",
"qspi",
"spi",
}
def uses_local_file_references(component_dir: Path) -> bool: def uses_local_file_references(component_dir: Path) -> bool:
"""Check if a component uses local file references via $component_dir. """Check if a component uses local file references via $component_dir.
@@ -182,18 +194,26 @@ def create_grouping_signature(
"""Create a signature string for grouping components. """Create a signature string for grouping components.
Components with the same signature can be grouped together for testing. Components with the same signature can be grouped together for testing.
Only includes groupable bus types (I2C, SPI, BLE) - excludes point-to-point
protocols like UART that can't be shared.
Args: Args:
platform_buses: Mapping of platform to list of buses platform_buses: Mapping of platform to list of buses
platform: The specific platform to create signature for platform: The specific platform to create signature for
Returns: Returns:
Signature string (e.g., "i2c+uart_19200" or "spi") Signature string (e.g., "i2c" or "spi") or empty if no groupable buses
""" """
buses = platform_buses.get(platform, []) buses = platform_buses.get(platform, [])
if not buses: if not buses:
return "" return ""
return "+".join(sorted(buses))
# Only include groupable bus types in signature
groupable_buses = [b for b in buses if b in GROUPABLE_BUS_TYPES]
if not groupable_buses:
return ""
return "+".join(sorted(groupable_buses))
def group_components_by_signature( def group_components_by_signature(

View File

@@ -332,10 +332,13 @@ def run_grouped_component_tests(
if platform_filter and not platform.startswith(platform_filter): if platform_filter and not platform.startswith(platform_filter):
continue continue
# Only group if component has common bus configs # Only group if component has groupable bus configs
if buses: if buses:
signature = create_grouping_signature({platform: buses}, platform) signature = create_grouping_signature({platform: buses}, platform)
grouped_components[(platform, signature)].append(component) # Only add to grouped_components if signature is non-empty
# (empty means only non-groupable buses like UART)
if signature:
grouped_components[(platform, signature)].append(component)
# Print detailed grouping plan # Print detailed grouping plan
print("\nGrouping Plan:") print("\nGrouping Plan:")