mirror of
https://github.com/esphome/esphome.git
synced 2026-10-02 17:30:22 +00:00
Trim comments
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user