Test: guard the repository paths README.md tells users to download - #185
Open
AmaadMartin wants to merge 2 commits into
Open
Test: guard the repository paths README.md tells users to download#185AmaadMartin wants to merge 2 commits into
AmaadMartin wants to merge 2 commits into
Conversation
added 2 commits
August 8, 2026 10:25
README.md publishes URLs into this repository -- the logo, docs/guides, contributing/samples and the constraints-<ver>.txt the install recipe tells users to curl. Nothing asserted those paths exist, so the window in which no constraints file was committed passed with a green suite. The new module also pins the parts of the download contract that make the file worth downloading: every interpreter in the generator script's PYTHON_VERSIONS array has a non-empty constraints file, that list agrees with the pyproject classifiers, each file keeps the two-line header that update_constraints.sh --check parses its snapshot date from, and every requirement line pins exactly.
…constant The module hand-rolled its own ancestor walk when tests/unittests already exports REPO_ROOT. Reuse it, and drop the two meta-tests of the deleted helper: the module-level skip guarantees the condition the first one asserted, so it could never fail.
This was referenced Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
Link to an existing issue (if applicable):
Or, if no issue exists, describe the change:
Problem:
README.mdtells users tocurlfour paths out of this repository. Nothing asserts that those paths exist; for a while one of them did not, and the test suite stayed green through the whole window.scripts/update_constraints.shand thepyproject.tomlclassifiers can also drift apart, which leaves a supported interpreter with no published constraints file.Solution: One new test module reads the real
README.md, the realscripts/update_constraints.sh, thepyproject.tomlclassifiers and the five committed constraints files. It fails when a documented path is absent from the checkout, when the two interpreter lists disagree, when a constraints file is missing, empty or no longer pins exactly, or when the two-line header stops carrying the--exclude-newerdate thatupdate_constraints.sh --checkreads back out of it. A last test asserts the README still documents the recipe, so the guard cannot be defused by deleting its subject. No production file changes: the diff is one added file.Collision check: I compared this against every open pull request on the fork. Four are adjacent. #108 adds a README link guard, but it also deletes the install recipe on the premise that no constraints file was ever published; that premise no longer holds, so I did not stack on it. #159 pins how the files are generated, #149 the generator CLI, #163 the pre-commit hook. None of them guards that a documented download exists.
Testing Plan
Unit Tests:
pytest tests/unittests/test_constraints_files.py -qgives 27 passed.Every guard was run against a mutated tree and confirmed to fail:
mv constraints-3.10.txt /tmp/test_readme_repo_references_resolve[constraints-3.10.txt],test_constraints_file_exists_for_every_supported_version[3.10]raw.githubusercontent.com/.../nope.txtlink toREADME.mdtest_readme_repo_references_resolve[nope.txt]PYTHON_VERSIONS=()in the scripttest_supported_versions_match_pyproject_classifiers3.14classifier frompyproject.tomltest_supported_versions_match_pyproject_classifiers# uv pip compileheadertest_constraints_header_is_machine_readable[3.11]a2a-sdk==1.1.1pin to>=test_constraints_files_pin_exact_versions[3.12]README.mdtest_readme_documents_the_constraints_install_recipe,test_readme_reference_extraction_is_not_emptyblob|treefrom the URL pattern, so the CI badge leaks intest_repo_paths_in_captures_only_paths_into_this_repositoryand 4 othersThe third mutation is the one worth calling out. An empty
PYTHON_VERSIONSarray makes the parametrized tests collect zero cases, which pytest reports as skipped, not failed.test_supported_versions_match_pyproject_classifiersasserts the list is non-empty for exactly that reason.Branch coverage of the new module is 95%, measured with
pytest --cov --cov-branch. Two environment guards account for the shortfall. Lines 49-50 are thetomlifallback that Python 3.11+ never takes; CI runs the 3.10 leg, which does take it. Line 91 is the module-levelpytest.skipfor a tree that does not export the source checkout layout. I verified that path by movingscripts/update_constraints.shaside and re-running:1 skipped. I kept both rather than delete a guard to raise the number.The module takes the repository root from the directory's shared
isolated_import_utils.REPO_ROOT.Manual End-to-End (E2E) Tests:
The download returns the two-line uv header, 1951 lines, and is identical to the committed file.
Collects the 29 new tests from the suite root, so the CI unit-test job runs them.
CI: Unit Tests, Mypy Check and A2A v0.3 Tests pass on every interpreter.
Pre-commit Linterfails, and it fails for a reason this change does not touch: theupdate-constraintshook regenerates the files against a rolling "4 days ago" date and rewrites the--exclude-newerheader, so it exits 1. The same job is red onmainat 352d11d, the commit this branch sits on, and on the fourmainruns before it.Checklist