From aba845691f7c4a52917432855ce34b611d1f7762 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 5 Mar 2026 13:31:47 -1000 Subject: [PATCH 1/2] Fix picotool tests on Windows Use platform-appropriate binary name (picotool.exe on Windows) when creating mock picotool files in tests. --- tests/unit_tests/test_main.py | 7 +++++-- tests/unit_tests/test_util.py | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/unit_tests/test_main.py b/tests/unit_tests/test_main.py index 31d5225914..817a18e2b9 100644 --- a/tests/unit_tests/test_main.py +++ b/tests/unit_tests/test_main.py @@ -8,6 +8,7 @@ import json import logging from pathlib import Path import re +import sys import time from typing import Any from unittest.mock import MagicMock, Mock, patch @@ -1339,7 +1340,8 @@ def test_upload_using_picotool_success(tmp_path: Path) -> None: toolchain_bin.mkdir(parents=True) picotool_dir = packages_dir / "tool-picotool-rp2040-earlephilhower" picotool_dir.mkdir(parents=True) - picotool = picotool_dir / "picotool" + binary_name = "picotool.exe" if sys.platform == "win32" else "picotool" + picotool = picotool_dir / binary_name picotool.touch() mock_idedata = MagicMock() @@ -1412,7 +1414,8 @@ def test_upload_using_picotool_permission_error(tmp_path: Path) -> None: toolchain_bin.mkdir(parents=True) picotool_dir = packages_dir / "tool-picotool-rp2040-earlephilhower" picotool_dir.mkdir(parents=True) - picotool = picotool_dir / "picotool" + binary_name = "picotool.exe" if sys.platform == "win32" else "picotool" + picotool = picotool_dir / binary_name picotool.touch() mock_idedata = MagicMock() diff --git a/tests/unit_tests/test_util.py b/tests/unit_tests/test_util.py index 8a2529a6f6..73fd6b34e2 100644 --- a/tests/unit_tests/test_util.py +++ b/tests/unit_tests/test_util.py @@ -4,6 +4,7 @@ from __future__ import annotations from pathlib import Path import subprocess +import sys from unittest.mock import MagicMock, patch import pytest @@ -415,9 +416,10 @@ def test_get_picotool_path_found(tmp_path: Path) -> None: gcc = toolchain_dir / "arm-none-eabi-gcc" gcc.touch() + binary_name = "picotool.exe" if sys.platform == "win32" else "picotool" picotool_dir = packages_dir / "tool-picotool-rp2040-earlephilhower" picotool_dir.mkdir(parents=True) - picotool = picotool_dir / "picotool" + picotool = picotool_dir / binary_name picotool.touch() result = util.get_picotool_path(str(gcc)) From 59b40de97ab6e27609b3827edc5aa341771aafa4 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 5 Mar 2026 14:13:52 -1000 Subject: [PATCH 2/2] silence warnings from code we do not control --- esphome/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/__main__.py b/esphome/__main__.py index cb2345bc6c..16fa32ee96 100644 --- a/esphome/__main__.py +++ b/esphome/__main__.py @@ -762,7 +762,7 @@ def _find_picotool() -> Path | None: try: idedata = platformio_api.get_idedata(CORE.config) - except Exception: # noqa: BLE001 + except Exception: # noqa: BLE001 # pylint: disable=broad-except return None return get_picotool_path(idedata.cc_path)