Trim comments

This commit is contained in:
J. Nick Koston
2026-08-27 10:39:50 -05:00
parent 61c0f84ed2
commit 6a56dffd28
4 changed files with 9 additions and 12 deletions
+1 -1
View File
@@ -579,7 +579,7 @@ def _make_registry_client() -> Any:
from esphome.platformio.runner import patch_registry_private_packages
# Every lookup would otherwise sleep ~500 ms in PlatformIO's account probe
# Otherwise every lookup sleeps ~500 ms in PlatformIO's account probe
patch_registry_private_packages()
class _Registry(PackageManagerRegistryMixin):
+3 -6
View File
@@ -109,12 +109,9 @@ def patch_file_downloader() -> None:
def patch_registry_private_packages() -> None:
"""Answer PlatformIO's private-package probe without the network.
``RegistryClient.get_package()`` calls ``allowed_private_packages()``
before it checks its own HTTP cache. That probe goes through
``AccountClient``'s throttled ``send_request``, which sleeps up to 500 ms
to space out requests and then fails at once without a PlatformIO login,
so every registry lookup costs half a second of sleep for nothing.
ESPHome never uses private registry packages, so answer False directly.
``RegistryClient.get_package()`` runs the probe before checking its HTTP
cache, and the throttled account request behind it sleeps up to 500 ms
before failing without a login. ESPHome never uses private packages.
"""
from platformio.registry.client import RegistryClient
+2 -2
View File
@@ -225,11 +225,11 @@ def test_resolve_registry_version_raises_without_pkg_file(monkeypatch):
def test_make_registry_client_skips_private_package_probe(monkeypatch):
"""Resolving through our client never sleeps in PlatformIO's account probe."""
"""Our client never calls PlatformIO's account probe."""
from platformio.account.client import AccountClient
from platformio.registry.client import RegistryClient
# Undo the class-level patch after the test so other tests see the original
# Restore PlatformIO's own probe after the test
monkeypatch.setattr(
RegistryClient,
"allowed_private_packages",
+3 -3
View File
@@ -97,7 +97,7 @@ def test_main_still_filters_a_drained_partial_line(
def test_main_applies_registry_private_packages_patch(
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""The probe patch is installed before PlatformIO gets control."""
"""The probe is patched before PlatformIO runs."""
order: list[str] = []
_prepare_main(monkeypatch, lambda: order.append("pio") or 0)
monkeypatch.setattr(
@@ -109,7 +109,7 @@ def test_main_applies_registry_private_packages_patch(
def _restore_registry_probe(monkeypatch: pytest.MonkeyPatch) -> None:
"""Undo the class-level patch after the test so other tests see PlatformIO's own probe."""
"""Restore PlatformIO's own probe after the test."""
from platformio.registry.client import RegistryClient
monkeypatch.setattr(
@@ -122,7 +122,7 @@ def _restore_registry_probe(monkeypatch: pytest.MonkeyPatch) -> None:
def test_patch_registry_private_packages_skips_account_probe(
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""The patched probe answers False without touching the account client."""
"""Answers False without touching the account client."""
from platformio.account.client import AccountClient
from platformio.registry.client import RegistryClient