Files
netmover/tests/test_release_script.py
T
Florian WildeandClaude Opus 5.5 a627044df7
CI / pruefen (3.12) (push) Waiting to run
CI / pruefen (3.13) (push) Waiting to run
CI / release (push) Blocked by required conditions
chore: Gitea-Releases aus dem Changelog – Skript und CI-Job
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:27:27 +01:00

42 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""scripts/gitea_release.py: Release-Text aus dem Changelog."""
from __future__ import annotations
import importlib.util
import re
from pathlib import Path
from types import ModuleType
import pytest
ROOT = Path(__file__).resolve().parent.parent
def _script() -> ModuleType:
spec = importlib.util.spec_from_file_location(
"gitea_release", ROOT / "scripts/gitea_release.py"
)
assert spec and spec.loader
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
return mod
def test_every_changelog_version_has_notes() -> None:
rel = _script()
text = (ROOT / "CHANGELOG.md").read_text()
versions = re.findall(r"^## \[(\d+\.\d+\.\d+)\]", text, re.M)
assert "0.1.0" in versions
for v in versions:
notes = rel.changelog_section(text, v)
assert notes and "## [" not in notes and not notes.startswith("[")
def test_section_boundaries() -> None:
rel = _script()
text = "## [Unreleased]\n\n## [0.2.0] – x\n\n- neu\n\n## [0.1.0] – y\n\n- alt\n\n[0.2.0]: https://e\n"
assert rel.changelog_section(text, "0.2.0") == "- neu"
assert rel.changelog_section(text, "0.1.0") == "- alt"
with pytest.raises(SystemExit):
rel.changelog_section(text, "9.9.9")