mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
[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
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user