mirror of
https://github.com/esphome/esphome.git
synced 2025-10-21 19:23:45 +01:00
Merge branch 'choose_upload_no_devices_fix' into integration
This commit is contained in:
@@ -11,7 +11,7 @@ ci:
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
# Ruff version.
|
# Ruff version.
|
||||||
rev: v0.14.0
|
rev: v0.14.1
|
||||||
hooks:
|
hooks:
|
||||||
# Run the linter.
|
# Run the linter.
|
||||||
- id: ruff
|
- id: ruff
|
||||||
|
@@ -185,7 +185,9 @@ def choose_upload_log_host(
|
|||||||
else:
|
else:
|
||||||
resolved.append(device)
|
resolved.append(device)
|
||||||
if not resolved:
|
if not resolved:
|
||||||
_LOGGER.error("All specified devices: %s could not be resolved.", defaults)
|
raise EsphomeError(
|
||||||
|
f"All specified devices {defaults} could not be resolved. Is the device connected to the network?"
|
||||||
|
)
|
||||||
return resolved
|
return resolved
|
||||||
|
|
||||||
# No devices specified, show interactive chooser
|
# No devices specified, show interactive chooser
|
||||||
|
@@ -828,6 +828,9 @@ async def to_code(config):
|
|||||||
# Disable dynamic log level control to save memory
|
# Disable dynamic log level control to save memory
|
||||||
add_idf_sdkconfig_option("CONFIG_LOG_DYNAMIC_LEVEL_CONTROL", False)
|
add_idf_sdkconfig_option("CONFIG_LOG_DYNAMIC_LEVEL_CONTROL", False)
|
||||||
|
|
||||||
|
# Reduce PHY TX power in the event of a brownout
|
||||||
|
add_idf_sdkconfig_option("CONFIG_ESP_PHY_REDUCE_TX_POWER", True)
|
||||||
|
|
||||||
# Set default CPU frequency
|
# Set default CPU frequency
|
||||||
add_idf_sdkconfig_option(
|
add_idf_sdkconfig_option(
|
||||||
f"CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_{config[CONF_CPU_FREQUENCY][:-3]}", True
|
f"CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_{config[CONF_CPU_FREQUENCY][:-3]}", True
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
pylint==4.0.1
|
pylint==4.0.1
|
||||||
flake8==7.3.0 # also change in .pre-commit-config.yaml when updating
|
flake8==7.3.0 # also change in .pre-commit-config.yaml when updating
|
||||||
ruff==0.14.0 # also change in .pre-commit-config.yaml when updating
|
ruff==0.14.1 # also change in .pre-commit-config.yaml when updating
|
||||||
pyupgrade==3.21.0 # also change in .pre-commit-config.yaml when updating
|
pyupgrade==3.21.0 # also change in .pre-commit-config.yaml when updating
|
||||||
pre-commit
|
pre-commit
|
||||||
|
|
||||||
|
@@ -321,12 +321,14 @@ def test_choose_upload_log_host_with_serial_device_no_ports(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test SERIAL device when no serial ports are found."""
|
"""Test SERIAL device when no serial ports are found."""
|
||||||
setup_core()
|
setup_core()
|
||||||
result = choose_upload_log_host(
|
with pytest.raises(
|
||||||
|
EsphomeError, match="All specified devices .* could not be resolved"
|
||||||
|
):
|
||||||
|
choose_upload_log_host(
|
||||||
default="SERIAL",
|
default="SERIAL",
|
||||||
check_default=None,
|
check_default=None,
|
||||||
purpose=Purpose.UPLOADING,
|
purpose=Purpose.UPLOADING,
|
||||||
)
|
)
|
||||||
assert result == []
|
|
||||||
assert "No serial ports found, skipping SERIAL device" in caplog.text
|
assert "No serial ports found, skipping SERIAL device" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
@@ -367,12 +369,14 @@ def test_choose_upload_log_host_with_ota_device_with_api_config() -> None:
|
|||||||
"""Test OTA device when API is configured (no upload without OTA in config)."""
|
"""Test OTA device when API is configured (no upload without OTA in config)."""
|
||||||
setup_core(config={CONF_API: {}}, address="192.168.1.100")
|
setup_core(config={CONF_API: {}}, address="192.168.1.100")
|
||||||
|
|
||||||
result = choose_upload_log_host(
|
with pytest.raises(
|
||||||
|
EsphomeError, match="All specified devices .* could not be resolved"
|
||||||
|
):
|
||||||
|
choose_upload_log_host(
|
||||||
default="OTA",
|
default="OTA",
|
||||||
check_default=None,
|
check_default=None,
|
||||||
purpose=Purpose.UPLOADING,
|
purpose=Purpose.UPLOADING,
|
||||||
)
|
)
|
||||||
assert result == []
|
|
||||||
|
|
||||||
|
|
||||||
def test_choose_upload_log_host_with_ota_device_with_api_config_logging() -> None:
|
def test_choose_upload_log_host_with_ota_device_with_api_config_logging() -> None:
|
||||||
@@ -405,12 +409,14 @@ def test_choose_upload_log_host_with_ota_device_no_fallback() -> None:
|
|||||||
"""Test OTA device with no valid fallback options."""
|
"""Test OTA device with no valid fallback options."""
|
||||||
setup_core()
|
setup_core()
|
||||||
|
|
||||||
result = choose_upload_log_host(
|
with pytest.raises(
|
||||||
|
EsphomeError, match="All specified devices .* could not be resolved"
|
||||||
|
):
|
||||||
|
choose_upload_log_host(
|
||||||
default="OTA",
|
default="OTA",
|
||||||
check_default=None,
|
check_default=None,
|
||||||
purpose=Purpose.UPLOADING,
|
purpose=Purpose.UPLOADING,
|
||||||
)
|
)
|
||||||
assert result == []
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("mock_choose_prompt")
|
@pytest.mark.usefixtures("mock_choose_prompt")
|
||||||
@@ -615,21 +621,19 @@ def test_choose_upload_log_host_empty_defaults_list() -> None:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("mock_no_serial_ports", "mock_no_mqtt_logging")
|
@pytest.mark.usefixtures("mock_no_serial_ports", "mock_no_mqtt_logging")
|
||||||
def test_choose_upload_log_host_all_devices_unresolved(
|
def test_choose_upload_log_host_all_devices_unresolved() -> None:
|
||||||
caplog: pytest.LogCaptureFixture,
|
|
||||||
) -> None:
|
|
||||||
"""Test when all specified devices cannot be resolved."""
|
"""Test when all specified devices cannot be resolved."""
|
||||||
setup_core()
|
setup_core()
|
||||||
|
|
||||||
result = choose_upload_log_host(
|
with pytest.raises(
|
||||||
|
EsphomeError,
|
||||||
|
match=r"All specified devices \['SERIAL', 'OTA'\] could not be resolved",
|
||||||
|
):
|
||||||
|
choose_upload_log_host(
|
||||||
default=["SERIAL", "OTA"],
|
default=["SERIAL", "OTA"],
|
||||||
check_default=None,
|
check_default=None,
|
||||||
purpose=Purpose.UPLOADING,
|
purpose=Purpose.UPLOADING,
|
||||||
)
|
)
|
||||||
assert result == []
|
|
||||||
assert (
|
|
||||||
"All specified devices: ['SERIAL', 'OTA'] could not be resolved." in caplog.text
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("mock_no_serial_ports", "mock_no_mqtt_logging")
|
@pytest.mark.usefixtures("mock_no_serial_ports", "mock_no_mqtt_logging")
|
||||||
@@ -762,12 +766,14 @@ def test_choose_upload_log_host_no_address_with_ota_config() -> None:
|
|||||||
"""Test OTA device when OTA is configured but no address is set."""
|
"""Test OTA device when OTA is configured but no address is set."""
|
||||||
setup_core(config={CONF_OTA: {}})
|
setup_core(config={CONF_OTA: {}})
|
||||||
|
|
||||||
result = choose_upload_log_host(
|
with pytest.raises(
|
||||||
|
EsphomeError, match="All specified devices .* could not be resolved"
|
||||||
|
):
|
||||||
|
choose_upload_log_host(
|
||||||
default="OTA",
|
default="OTA",
|
||||||
check_default=None,
|
check_default=None,
|
||||||
purpose=Purpose.UPLOADING,
|
purpose=Purpose.UPLOADING,
|
||||||
)
|
)
|
||||||
assert result == []
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
Reference in New Issue
Block a user