mirror of
https://github.com/esphome/esphome.git
synced 2025-10-12 23:03:46 +01:00
adj
This commit is contained in:
@@ -1003,8 +1003,8 @@ def parse_args(argv):
|
|||||||
default=[],
|
default=[],
|
||||||
)
|
)
|
||||||
options_parser.add_argument(
|
options_parser.add_argument(
|
||||||
"--ignore-pin-conflicts",
|
"--testing-mode",
|
||||||
help="Disable pin conflict validation (for testing grouped components)",
|
help="Enable testing mode (disables validation checks for grouped component testing)",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
@@ -1266,7 +1266,7 @@ def run_esphome(argv):
|
|||||||
|
|
||||||
args = parse_args(argv)
|
args = parse_args(argv)
|
||||||
CORE.dashboard = args.dashboard
|
CORE.dashboard = args.dashboard
|
||||||
CORE.ignore_pin_conflicts = args.ignore_pin_conflicts
|
CORE.testing_mode = args.testing_mode
|
||||||
|
|
||||||
# Create address cache from command-line arguments
|
# Create address cache from command-line arguments
|
||||||
CORE.address_cache = AddressCache.from_cli_args(
|
CORE.address_cache = AddressCache.from_cli_args(
|
||||||
|
@@ -529,8 +529,8 @@ class EsphomeCore:
|
|||||||
self.dashboard = False
|
self.dashboard = False
|
||||||
# True if command is run from vscode api
|
# True if command is run from vscode api
|
||||||
self.vscode = False
|
self.vscode = False
|
||||||
# True if pin conflict validation should be ignored
|
# True if running in testing mode (disables validation checks for grouped testing)
|
||||||
self.ignore_pin_conflicts = False
|
self.testing_mode = False
|
||||||
# The name of the node
|
# The name of the node
|
||||||
self.name: str | None = None
|
self.name: str | None = None
|
||||||
# The friendly name of the node
|
# The friendly name of the node
|
||||||
|
@@ -246,12 +246,15 @@ def entity_duplicate_validator(platform: str) -> Callable[[ConfigType], ConfigTy
|
|||||||
"\n to distinguish them"
|
"\n to distinguish them"
|
||||||
)
|
)
|
||||||
|
|
||||||
raise cv.Invalid(
|
# Skip duplicate entity name validation when testing_mode is enabled
|
||||||
f"Duplicate {platform} entity with name '{entity_name}' found{device_prefix}. "
|
# This flag is used for grouped component testing
|
||||||
f"{conflict_msg}. "
|
if not CORE.testing_mode:
|
||||||
"Each entity on a device must have a unique name within its platform."
|
raise cv.Invalid(
|
||||||
f"{sanitized_msg}"
|
f"Duplicate {platform} entity with name '{entity_name}' found{device_prefix}. "
|
||||||
)
|
f"{conflict_msg}. "
|
||||||
|
"Each entity on a device must have a unique name within its platform."
|
||||||
|
f"{sanitized_msg}"
|
||||||
|
)
|
||||||
|
|
||||||
# Store metadata about this entity
|
# Store metadata about this entity
|
||||||
entity_metadata: EntityMetadata = {
|
entity_metadata: EntityMetadata = {
|
||||||
|
@@ -118,11 +118,7 @@ class PinRegistry(dict):
|
|||||||
parent_config = fconf.get_config_for_path(parent_path)
|
parent_config = fconf.get_config_for_path(parent_path)
|
||||||
final_val_fun(pin_config, parent_config)
|
final_val_fun(pin_config, parent_config)
|
||||||
allow_others = pin_config.get(CONF_ALLOW_OTHER_USES, False)
|
allow_others = pin_config.get(CONF_ALLOW_OTHER_USES, False)
|
||||||
if (
|
if count != 1 and not allow_others and not CORE.testing_mode:
|
||||||
count != 1
|
|
||||||
and not allow_others
|
|
||||||
and not CORE.ignore_pin_conflicts
|
|
||||||
):
|
|
||||||
raise cv.Invalid(
|
raise cv.Invalid(
|
||||||
f"Pin {pin_config[CONF_NUMBER]} is used in multiple places"
|
f"Pin {pin_config[CONF_NUMBER]} is used in multiple places"
|
||||||
)
|
)
|
||||||
|
@@ -9,7 +9,7 @@ Features:
|
|||||||
- Analyzes components for shared common bus configs
|
- Analyzes components for shared common bus configs
|
||||||
- Groups compatible components together
|
- Groups compatible components together
|
||||||
- Merges configs for grouped components
|
- Merges configs for grouped components
|
||||||
- Uses --ignore-pin-conflicts for grouped tests
|
- Uses --testing-mode for grouped tests
|
||||||
- Maintains backward compatibility with single component testing
|
- Maintains backward compatibility with single component testing
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ def run_esphome_test(
|
|||||||
build_dir: Path,
|
build_dir: Path,
|
||||||
esphome_command: str,
|
esphome_command: str,
|
||||||
continue_on_fail: bool,
|
continue_on_fail: bool,
|
||||||
use_ignore_pin_conflicts: bool = False,
|
use_testing_mode: bool = False,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Run esphome test for a single component.
|
"""Run esphome test for a single component.
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ def run_esphome_test(
|
|||||||
build_dir: Path to build directory
|
build_dir: Path to build directory
|
||||||
esphome_command: ESPHome command (config/compile)
|
esphome_command: ESPHome command (config/compile)
|
||||||
continue_on_fail: Whether to continue on failure
|
continue_on_fail: Whether to continue on failure
|
||||||
use_ignore_pin_conflicts: Whether to use --ignore-pin-conflicts flag
|
use_testing_mode: Whether to use --testing-mode flag
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if test passed, False otherwise
|
True if test passed, False otherwise
|
||||||
@@ -157,9 +157,9 @@ def run_esphome_test(
|
|||||||
"esphome",
|
"esphome",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add --ignore-pin-conflicts if needed (must be before subcommand)
|
# Add --testing-mode if needed (must be before subcommand)
|
||||||
if use_ignore_pin_conflicts:
|
if use_testing_mode:
|
||||||
cmd.append("--ignore-pin-conflicts")
|
cmd.append("--testing-mode")
|
||||||
|
|
||||||
# Add substitutions
|
# Add substitutions
|
||||||
cmd.extend(
|
cmd.extend(
|
||||||
@@ -184,8 +184,8 @@ def run_esphome_test(
|
|||||||
|
|
||||||
# Run command
|
# Run command
|
||||||
print(f"> [{component}] [{test_name}] [{platform_with_version}]")
|
print(f"> [{component}] [{test_name}] [{platform_with_version}]")
|
||||||
if use_ignore_pin_conflicts:
|
if use_testing_mode:
|
||||||
print(" (using --ignore-pin-conflicts)")
|
print(" (using --testing-mode)")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(cmd, check=not continue_on_fail)
|
result = subprocess.run(cmd, check=not continue_on_fail)
|
||||||
@@ -248,12 +248,12 @@ def run_grouped_test(
|
|||||||
output_content = base_content.replace("$component_test_file", merged_ref)
|
output_content = base_content.replace("$component_test_file", merged_ref)
|
||||||
output_file.write_text(output_content)
|
output_file.write_text(output_content)
|
||||||
|
|
||||||
# Build esphome command with --ignore-pin-conflicts
|
# Build esphome command with --testing-mode
|
||||||
cmd = [
|
cmd = [
|
||||||
sys.executable,
|
sys.executable,
|
||||||
"-m",
|
"-m",
|
||||||
"esphome",
|
"esphome",
|
||||||
"--ignore-pin-conflicts", # Required for grouped tests
|
"--testing-mode", # Required for grouped tests
|
||||||
"-s",
|
"-s",
|
||||||
"component_name",
|
"component_name",
|
||||||
group_name,
|
group_name,
|
||||||
@@ -273,7 +273,7 @@ def run_grouped_test(
|
|||||||
# Run command
|
# Run command
|
||||||
components_str = ", ".join(components)
|
components_str = ", ".join(components)
|
||||||
print(f"> [GROUPED: {components_str}] [{platform_with_version}]")
|
print(f"> [GROUPED: {components_str}] [{platform_with_version}]")
|
||||||
print(" (using --ignore-pin-conflicts)")
|
print(" (using --testing-mode)")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(cmd, check=not continue_on_fail)
|
result = subprocess.run(cmd, check=not continue_on_fail)
|
||||||
|
Reference in New Issue
Block a user