From c870ad328e7e1e7406d6ea391eb8b645fd4cedfd Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 11 May 2026 11:09:36 -0500 Subject: [PATCH] [cli] Fix Windows pytest: use platform-absolute path in --prebuilt-dir test The 'absolute paths pass through unchanged' test for _load_idedata hardcoded a POSIX-style absolute path ('/somewhere/else/bootloader.bin'). On Windows, Path.is_absolute() returns False for that shape -- absolute paths there require a drive letter -- so _resolve_prebuilt_idedata_paths classified it as relative and prepended CORE.prebuilt_dir, breaking the test's assertion. Replace the hardcoded POSIX path with a tmp_path-rooted one so it's platform-absolute on every runner. No production code change; this is a test-only fix surfaced by the windows-latest pytest matrix on PR #16348. Note: the macOS 3.14 failure on the same CI run is a flaky timing test (tests/dashboard/test_web_server.py::test_dashboard_subscriber_entries_update_interval, 50ms sleep expecting 2+ iterations at 10ms) unrelated to this PR. Issue: esphome/device-builder#572 --- tests/unit_tests/test_platformio_toolchain.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/unit_tests/test_platformio_toolchain.py b/tests/unit_tests/test_platformio_toolchain.py index bd43f20d14..5be3707307 100644 --- a/tests/unit_tests/test_platformio_toolchain.py +++ b/tests/unit_tests/test_platformio_toolchain.py @@ -314,7 +314,11 @@ def test_load_idedata_absolute_paths_in_prebuilt_pass_through( prebuilt_dir = setup_core / "prebuilt" prebuilt_dir.mkdir() - abs_bootloader = "/somewhere/else/bootloader.bin" + # Use a tmp-rooted absolute path so the test passes on Windows too; + # Path.is_absolute() requires a drive letter on win32, so a bare + # "/somewhere/else/..." string would be classified as relative there + # and trigger the wrong code path. + abs_bootloader = str(setup_core / "elsewhere" / "bootloader.bin") prebuilt_idedata = prebuilt_dir / "idedata.json" prebuilt_idedata.write_text( json.dumps(