mirror of
				https://github.com/esphome/esphome.git
				synced 2025-11-04 09:01:49 +00:00 
			
		
		
		
	fix
This commit is contained in:
		@@ -50,6 +50,18 @@ VALID_BUS_CONFIGS = {
 | 
			
		||||
    "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:
 | 
			
		||||
    """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.
 | 
			
		||||
 | 
			
		||||
    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:
 | 
			
		||||
        platform_buses: Mapping of platform to list of buses
 | 
			
		||||
        platform: The specific platform to create signature for
 | 
			
		||||
 | 
			
		||||
    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, [])
 | 
			
		||||
    if not buses:
 | 
			
		||||
        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(
 | 
			
		||||
 
 | 
			
		||||
@@ -332,10 +332,13 @@ def run_grouped_component_tests(
 | 
			
		||||
            if platform_filter and not platform.startswith(platform_filter):
 | 
			
		||||
                continue
 | 
			
		||||
 | 
			
		||||
            # Only group if component has common bus configs
 | 
			
		||||
            # Only group if component has groupable bus configs
 | 
			
		||||
            if buses:
 | 
			
		||||
                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("\nGrouping Plan:")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user