mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 14:43:51 +00:00
[packages] Allow list instead of dict for packages (#8688)
This commit is contained in:
@@ -76,10 +76,11 @@ def test_package_unused(basic_esphome, basic_wifi):
|
||||
|
||||
def test_package_invalid_dict(basic_esphome, basic_wifi):
|
||||
"""
|
||||
Ensures an error is raised if packages is not valid.
|
||||
If a url: key is present, it's expected to be well-formed remote package spec. Ensure an error is raised if not.
|
||||
Any other simple dict passed as a package will be merged as usual but may fail later validation.
|
||||
|
||||
"""
|
||||
config = {CONF_ESPHOME: basic_esphome, CONF_PACKAGES: basic_wifi}
|
||||
config = {CONF_ESPHOME: basic_esphome, CONF_PACKAGES: basic_wifi | {CONF_URL: ""}}
|
||||
|
||||
with pytest.raises(cv.Invalid):
|
||||
do_packages_pass(config)
|
||||
|
||||
3
tests/components/packages/package.yaml
Normal file
3
tests/components/packages/package.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
sensor:
|
||||
- platform: template
|
||||
id: package_sensor
|
||||
11
tests/components/packages/test.esp32-ard.yaml
Normal file
11
tests/components/packages/test.esp32-ard.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
packages:
|
||||
- sensor:
|
||||
- platform: template
|
||||
id: inline_sensor
|
||||
- !include package.yaml
|
||||
- github://esphome/esphome/tests/components/template/common.yaml@dev
|
||||
- url: https://github.com/esphome/esphome
|
||||
file: tests/components/binary_sensor_map/common.yaml
|
||||
ref: dev
|
||||
refresh: 1d
|
||||
|
||||
13
tests/components/packages/test.esp32-idf.yaml
Normal file
13
tests/components/packages/test.esp32-idf.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
packages:
|
||||
sensor:
|
||||
sensor:
|
||||
- platform: template
|
||||
id: inline_sensor
|
||||
local: !include package.yaml
|
||||
shorthand: github://esphome/esphome/tests/components/template/common.yaml@dev
|
||||
github:
|
||||
url: https://github.com/esphome/esphome
|
||||
file: tests/components/binary_sensor_map/common.yaml
|
||||
ref: dev
|
||||
refresh: 1d
|
||||
|
||||
Reference in New Issue
Block a user