Call the file unreadable, not damaged, and tolerate a concurrent removal

EACCES/EISDIR land in the same arm, so the warning no longer claims
corruption; missing_ok on the unlink keeps a concurrent clean from
logging a spurious failure for a file already in the desired state.
This commit is contained in:
J. Nick Koston
2026-08-23 13:19:50 -05:00
parent dd74abe228
commit c3addd95e3
2 changed files with 9 additions and 7 deletions
+2 -2
View File
@@ -2161,7 +2161,7 @@ def test_copy_src_tree_missing_build_info_rebuilds_quietly(
build_info_json_path.unlink()
_run_copy_src_tree()
assert json.loads(build_info_json_path.read_text())["config_hash"] == 0xDEADBEEF
assert "damaged" not in caplog.text
assert "unreadable" not in caplog.text
@patch("esphome.writer.CORE")
@@ -2189,7 +2189,7 @@ def test_copy_src_tree_unremovable_damaged_build_info_is_logged(
with patch.object(Path, "unlink", fail_on_build_info):
_run_copy_src_tree()
assert "Could not remove damaged build_info.json" in caplog.text
assert "Could not remove unreadable build_info.json" in caplog.text
assert json.loads(build_info_json_path.read_text())["config_hash"] == 0xDEADBEEF