From b92233038dc7cb4680da6fa3c3b917406186c29a Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 3 Nov 2026 23:40:23 +0100 Subject: [PATCH] fix(test): drop the bare PyPI API base the URL check probes #1364 named https://pypi.org/pypi twice in tests/external/update/pip/test_ansible_python_cap.py, in the module docstring and in the PYPI constant. tests/external/repository/ test_urls_reachable.py probes every literal URL, and the bare API base answers 404 (only //json exists), so test-external fails on main 9c79915c07. The docstring now names the JSON API on pypi.org without a URL, and the constant becomes the template https://pypi.org/pypi/{}, which the URL scan skips as a placeholder. The requests the check sends are unchanged. Co-Authored-By: Claude Opus 5.5 --- tests/external/update/pip/test_ansible_python_cap.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/external/update/pip/test_ansible_python_cap.py b/tests/external/update/pip/test_ansible_python_cap.py index af41f9b527..4f8ba83861 100644 --- a/tests/external/update/pip/test_ansible_python_cap.py +++ b/tests/external/update/pip/test_ansible_python_cap.py @@ -8,8 +8,8 @@ watcher. This is external because the answer lives on PyPI: the newest ``ansible`` release, the ansible-core range it requires, and the Python classifiers of the -newest ansible-core inside that range. It contacts ``https://pypi.org/pypi`` -only. +newest ansible-core inside that range. It contacts only the JSON API on +``pypi.org``. - The test fails when the cap allows a Python minor that this ansible-core does not support, because the bootstrap would then pick an interpreter the @@ -37,7 +37,7 @@ from utils.cache.files import read_text from . import PROJECT_ROOT -PYPI = "https://pypi.org/pypi" +PYPI_API = "https://pypi.org/pypi/{}" TIMEOUT_SECONDS = 15 USER_AGENT = "infinito-nexus python cap check" CLASSIFIER = re.compile(r"^Programming Language :: Python :: 3\.(\d+)$") @@ -59,7 +59,7 @@ def pypi_json(path: str) -> dict: PyPIUnavailableError: the request failed or returned no JSON. """ request = urllib.request.Request( # noqa: S310 - fixed https PyPI origin, path built from literal package names - f"{PYPI}/{path}", headers={"User-Agent": USER_AGENT} + PYPI_API.format(path), headers={"User-Agent": USER_AGENT} ) try: with urllib.request.urlopen(request, timeout=TIMEOUT_SECONDS) as response: # noqa: S310 - fixed https PyPI origin, path built from literal package names