From 6a56dffd284603690d9fadd62612b6d9a94f8766 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 27 Aug 2026 10:39:50 -0500 Subject: [PATCH] Trim comments --- esphome/platformio/library.py | 2 +- esphome/platformio/runner.py | 9 +++------ tests/unit_tests/test_platformio_library.py | 4 ++-- tests/unit_tests/test_platformio_runner.py | 6 +++--- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/esphome/platformio/library.py b/esphome/platformio/library.py index ae0d86368a..ebeae21645 100644 --- a/esphome/platformio/library.py +++ b/esphome/platformio/library.py @@ -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): diff --git a/esphome/platformio/runner.py b/esphome/platformio/runner.py index 8107fd0e2b..a5193bfa08 100644 --- a/esphome/platformio/runner.py +++ b/esphome/platformio/runner.py @@ -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 diff --git a/tests/unit_tests/test_platformio_library.py b/tests/unit_tests/test_platformio_library.py index 0928e30010..210e949c56 100644 --- a/tests/unit_tests/test_platformio_library.py +++ b/tests/unit_tests/test_platformio_library.py @@ -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", diff --git a/tests/unit_tests/test_platformio_runner.py b/tests/unit_tests/test_platformio_runner.py index ca59b8bee1..a7e9ef8596 100644 --- a/tests/unit_tests/test_platformio_runner.py +++ b/tests/unit_tests/test_platformio_runner.py @@ -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