mirror of
https://github.com/esphome/esphome.git
synced 2025-09-02 03:12:20 +01:00
Support for LibreTiny platform (RTL8710, BK7231 & other modules) (#3509)
Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl> Co-authored-by: Sam Neirinck <git@samneirinck.com> Co-authored-by: David Buezas <dbuezas@users.noreply.github.com> Co-authored-by: Stroe Andrei Catalin <catalin2402@gmail.com> Co-authored-by: Sam Neirinck <github@samneirinck.be> Co-authored-by: Péter Sárközi <xmisterhu@gmail.com> Co-authored-by: Hajo Noerenberg <hn@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
22c0b0abaa
commit
a9630ac847
@@ -3,6 +3,9 @@
|
||||
import esphome.wizard as wz
|
||||
import pytest
|
||||
from esphome.components.esp8266.boards import ESP8266_BOARD_PINS
|
||||
from esphome.components.esp32.boards import ESP32_BOARD_PINS
|
||||
from esphome.components.bk72xx.boards import BK72XX_BOARD_PINS
|
||||
from esphome.components.rtl87xx.boards import RTL87XX_BOARD_PINS
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
|
||||
@@ -140,11 +143,11 @@ def test_wizard_write_defaults_platform_from_board_esp32(
|
||||
default_config, tmp_path, monkeypatch
|
||||
):
|
||||
"""
|
||||
If the platform is not explicitly set, use "ESP32" if the board is not one of the ESP8266 boards
|
||||
If the platform is not explicitly set, use "ESP32" if the board is one of the ESP32 boards
|
||||
"""
|
||||
# Given
|
||||
del default_config["platform"]
|
||||
default_config["board"] = "foo"
|
||||
default_config["board"] = [*ESP32_BOARD_PINS][0]
|
||||
|
||||
monkeypatch.setattr(wz, "write_file", MagicMock())
|
||||
|
||||
@@ -156,6 +159,46 @@ def test_wizard_write_defaults_platform_from_board_esp32(
|
||||
assert "esp32:" in generated_config
|
||||
|
||||
|
||||
def test_wizard_write_defaults_platform_from_board_bk72xx(
|
||||
default_config, tmp_path, monkeypatch
|
||||
):
|
||||
"""
|
||||
If the platform is not explicitly set, use "BK72XX" if the board is one of BK72XX boards
|
||||
"""
|
||||
# Given
|
||||
del default_config["platform"]
|
||||
default_config["board"] = [*BK72XX_BOARD_PINS][0]
|
||||
|
||||
monkeypatch.setattr(wz, "write_file", MagicMock())
|
||||
|
||||
# When
|
||||
wz.wizard_write(tmp_path, **default_config)
|
||||
|
||||
# Then
|
||||
generated_config = wz.write_file.call_args.args[1]
|
||||
assert "bk72xx:" in generated_config
|
||||
|
||||
|
||||
def test_wizard_write_defaults_platform_from_board_rtl87xx(
|
||||
default_config, tmp_path, monkeypatch
|
||||
):
|
||||
"""
|
||||
If the platform is not explicitly set, use "RTL87XX" if the board is one of RTL87XX boards
|
||||
"""
|
||||
# Given
|
||||
del default_config["platform"]
|
||||
default_config["board"] = [*RTL87XX_BOARD_PINS][0]
|
||||
|
||||
monkeypatch.setattr(wz, "write_file", MagicMock())
|
||||
|
||||
# When
|
||||
wz.wizard_write(tmp_path, **default_config)
|
||||
|
||||
# Then
|
||||
generated_config = wz.write_file.call_args.args[1]
|
||||
assert "rtl87xx:" in generated_config
|
||||
|
||||
|
||||
def test_safe_print_step_prints_step_number_and_description(monkeypatch):
|
||||
"""
|
||||
The safe_print_step function prints the step number and the passed description
|
||||
@@ -186,7 +229,7 @@ def test_default_input_uses_default_if_no_input_supplied(monkeypatch):
|
||||
"""
|
||||
|
||||
# Given
|
||||
monkeypatch.setattr("builtins.input", lambda _: "")
|
||||
monkeypatch.setattr("builtins.input", lambda _=None: "")
|
||||
default_string = "foobar"
|
||||
|
||||
# When
|
||||
@@ -203,7 +246,7 @@ def test_default_input_uses_user_supplied_value(monkeypatch):
|
||||
|
||||
# Given
|
||||
user_input = "A value"
|
||||
monkeypatch.setattr("builtins.input", lambda _: user_input)
|
||||
monkeypatch.setattr("builtins.input", lambda _=None: user_input)
|
||||
default_string = "foobar"
|
||||
|
||||
# When
|
||||
|
Reference in New Issue
Block a user