Fix command line substitutions without any yaml substitutions (#6644)

This commit is contained in:
Jesse Hills 2024-04-29 07:33:52 +12:00 committed by GitHub
parent 0ef7781bb3
commit a700ae481d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 5 additions and 53 deletions

View File

@ -116,7 +116,7 @@ def do_substitution_pass(config, command_line_substitutions, ignore_missing=Fals
if CONF_SUBSTITUTIONS not in config and not command_line_substitutions:
return
substitutions = config[CONF_SUBSTITUTIONS]
substitutions = config.get(CONF_SUBSTITUTIONS)
if substitutions is None:
substitutions = command_line_substitutions
elif command_line_substitutions:

View File

@ -756,11 +756,11 @@ def validate_config(
CORE.raw_config = config
# 1. Load substitutions
if CONF_SUBSTITUTIONS in config:
if CONF_SUBSTITUTIONS in config or command_line_substitutions:
from esphome.components import substitutions
result[CONF_SUBSTITUTIONS] = {
**config[CONF_SUBSTITUTIONS],
**config.get(CONF_SUBSTITUTIONS, {}),
**command_line_substitutions,
}
result.add_output_path([CONF_SUBSTITUTIONS], CONF_SUBSTITUTIONS)

View File

@ -37,9 +37,9 @@ start_esphome() {
# Start esphome process
echo "> [$target_component] [$test_name] [$target_platform]"
echo "esphome -s component_name $target_component -s test_name $test_name -s target_platform $target_platform $esphome_command $component_test_file"
echo "esphome -s component_name $target_component -s component_dir ../../components/$target_component -s test_name $test_name -s target_platform $target_platform $esphome_command $component_test_file"
# TODO: Validate escape of Command line substitution value
esphome -s component_name $target_component -s test_name $test_name -s target_platform $target_platform $esphome_command $component_test_file
esphome -s component_name $target_component -s component_dir ../../components/$target_component -s test_name $test_name -s target_platform $target_platform $esphome_command $component_test_file
}
# Find all test yaml files.

View File

@ -12,8 +12,4 @@ packages:
component_under_test: !include
file: $component_test_file
vars:
component_name: $component_name
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"

View File

@ -14,8 +14,4 @@ packages:
component_under_test: !include
file: $component_test_file
vars:
component_name: $component_name
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"

View File

@ -14,8 +14,4 @@ packages:
component_under_test: !include
file: $component_test_file
vars:
component_name: $component_name
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"

View File

@ -14,8 +14,4 @@ packages:
component_under_test: !include
file: $component_test_file
vars:
component_name: $component_name
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"

View File

@ -14,8 +14,4 @@ packages:
component_under_test: !include
file: $component_test_file
vars:
component_name: $component_name
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"

View File

@ -15,8 +15,4 @@ packages:
component_under_test: !include
file: $component_test_file
vars:
component_name: $component_name
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"

View File

@ -15,8 +15,4 @@ packages:
component_under_test: !include
file: $component_test_file
vars:
component_name: $component_name
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"

View File

@ -15,8 +15,4 @@ packages:
component_under_test: !include
file: $component_test_file
vars:
component_name: $component_name
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"

View File

@ -15,8 +15,4 @@ packages:
component_under_test: !include
file: $component_test_file
vars:
component_name: $component_name
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"

View File

@ -12,8 +12,4 @@ packages:
component_under_test: !include
file: $component_test_file
vars:
component_name: $component_name
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"

View File

@ -12,8 +12,4 @@ packages:
component_under_test: !include
file: $component_test_file
vars:
component_name: $component_name
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"

View File

@ -15,8 +15,4 @@ packages:
component_under_test: !include
file: $component_test_file
vars:
component_name: $component_name
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"