fix(release): verify final candidates and refresh SVG parser

This commit is contained in:
Xubin Ren committed 2026-10-28 16:54:41 +08:00
1 parent 4574a9b859
commit 19c18aaafd
7 files changed
+92 -10

No files matched your search

+26
View File
@@ -10,6 +10,7 @@ from scripts.release_candidate import (
_candidate_identity,
_source_payload,
prepare_preview,
prepare_stable,
preview_version,
)
@@ -64,6 +65,31 @@ def test_dirty_source_is_not_accidentally_included_in_candidate(tmp_path, source
assert (root / "nanobot/__init__.py").read_text() == "uncommitted work"
def test_stable_preparation_preserves_exact_source_and_ignores_local_changes(tmp_path, source):
root, commit = source
(root / "nanobot/__init__.py").write_text("uncommitted work")
target = tmp_path / "stable"
result = prepare_stable(root, target, source_commit=commit, version="0.3.5")
assert result == {"version": "0.3.5", "source_commit": commit, "candidate_commit": commit}
assert git(target, "rev-parse", "HEAD") == commit
assert git(target, "status", "--porcelain") == ""
assert _candidate_identity(target, commit) == ("0.3.5", ">=3.11", commit)
assert (root / "nanobot/__init__.py").read_text() == "uncommitted work"
def test_stable_preparation_refuses_version_mismatch_and_published_identity(tmp_path, source):
root, commit = source
target = tmp_path / "stable"
with pytest.raises(ValueError, match="already declare"):
prepare_stable(root, target, source_commit=commit, version="0.4.0")
with pytest.raises(ValueError, match="final version"):
prepare_stable(root, target, source_commit=commit, version="0.4.0.dev1")
git(root, "tag", "v0.3.5")
with pytest.raises(ValueError, match="existing stable tag"):
prepare_stable(root, target, source_commit=commit, version="0.3.5")
assert not target.exists()
def test_refuses_existing_output_and_published_stable_base(tmp_path, source):
root, commit = source
with pytest.raises(ValueError, match="new directory"):