From 5684f542b6873dfbfc20e7a97a3cda30b88e49a8 Mon Sep 17 00:00:00 2001 From: Brad Edwards Date: Thu, 1 Oct 2026 07:49:03 +0200 Subject: [PATCH] fix(release): pass the repository root when loading the release closure profile --- .../test_issue_1226_release_evidence_cli.py | 34 +++++++++++++++++++ tools/release_evidence.py | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/implementations/python/tests/test_issue_1226_release_evidence_cli.py b/implementations/python/tests/test_issue_1226_release_evidence_cli.py index d130172d8..c4d2dac43 100644 --- a/implementations/python/tests/test_issue_1226_release_evidence_cli.py +++ b/implementations/python/tests/test_issue_1226_release_evidence_cli.py @@ -283,3 +283,37 @@ def test_the_evidence_index_is_itself_verified_as_an_attested_subject(tmp_path: runner=_recording_runner(seen), ) assert "release-evidence-index.json" in {Path(command[3]).name for command in seen} + + +def test_generate_loads_the_closure_profile_from_the_admitted_repository(tmp_path: Path, monkeypatch) -> None: + from tools.python_closure_profiles import load_python_closure_profile + + class _StopAfterProfile(Exception): + pass + + selected: list[tuple[str, str]] = [] + + def stop_at_target_environment(python_version: str, platform: str, *, full_version: str) -> None: + selected.append((python_version, platform)) + raise _StopAfterProfile + + monkeypatch.setattr( + release_evidence, + "_distribution_paths", + lambda _directory: (tmp_path / "raes.whl", tmp_path / "raes.tar.gz", tmp_path / "derived.whl"), + ) + monkeypatch.setattr(release_evidence, "target_environment", stop_at_target_environment) + paths = release_evidence.GeneratePaths( + repo_root=REPO_ROOT, + distribution_dir=tmp_path, + evidence_dir=tmp_path / "evidence", + environment_dir=tmp_path, + sdist_environment_dir=tmp_path, + ) + profile_id = "public-linux-x86_64-cp312-all-extras" + + with pytest.raises(_StopAfterProfile): + release_evidence.generate(paths=paths, profile_id=profile_id, release_tag="v0.0.0", environment=_ENVIRONMENT) + + profile = load_python_closure_profile(REPO_ROOT, profile_id) + assert selected == [(profile.python_version, profile.platform)] diff --git a/tools/release_evidence.py b/tools/release_evidence.py index 089e1ce06..813830058 100644 --- a/tools/release_evidence.py +++ b/tools/release_evidence.py @@ -159,7 +159,7 @@ def generate( wheel, sdist, derived = _distribution_paths(distribution_dir) identity = release_identity(environment) - profile = load_python_closure_profile(profile_id) + profile = load_python_closure_profile(repo_root, profile_id) markers = target_environment( profile.python_version, profile.platform,