Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

dbbasic-object-server/tests/test_changelog_check.py
Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 19 minutes ago History
test_changelog_check.py · 1.4 KB · 44 lines
1"""scripts/changelog_check.py lists commits the Unreleased section omits."""
2
3from __future__ import annotations
4
5import subprocess
6import sys
7from pathlib import Path
8
9sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "scripts"))
10
11import changelog_check # noqa: E402
12
13
14def git(repo, *args):
15 return subprocess.run(
16 ["git", "-C", str(repo), "-c", "user.name=t", "-c", "user.email=t@t",
17 "-c", "commit.gpgsign=false", "-c", "tag.gpgsign=false", *args],
18 check=True, capture_output=True, text=True,
19 ).stdout.strip()
20
21
22def commit(repo, name):
23 (repo / name).write_text(name)
24 git(repo, "add", name)
25 git(repo, "commit", "-m", f"add {name}")
26 return git(repo, "rev-parse", "--short", "HEAD")
27
28
29def test_reports_missing_and_passes_when_complete(tmp_path, capsys):
30 git(tmp_path, "init", "-q")
31 commit(tmp_path, "a")
32 git(tmp_path, "tag", "v1")
33 old = commit(tmp_path, "b")
34 new = commit(tmp_path, "c")
35 log = tmp_path / "CHANGELOG.md"
36
37 # old hash is only in a released section, so it does not count
38 log.write_text(f"# Changelog\n\n## Unreleased\n\n- thing `{new}`\n\n## v1\n\n- `{old}`\n")
39 assert changelog_check.main(["--repo", str(tmp_path)]) == 1
40 out = capsys.readouterr().out
41 assert old in out and new not in out
42
43 log.write_text(f"# Changelog\n\n## Unreleased\n\n- `{old}` `{new}`\n\n## v1\n")
44 assert changelog_check.main(["--repo", str(tmp_path)]) == 0