testsAndMisc/python_pkg/tests/test_cli_credit.py
Krzysztof kuhy Rudnicki e9ba82ed66
Some checks are pending
md-naming / markdown naming convention (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (mypy, mypy) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (pylint, pylint) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (shellcheck, shellcheck) (push) Waiting to run
Python tests / test (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / lib-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
Put the kuhy credit on every python_pkg CLI
Twelve interactive CLIs end their --help on credit_line() from
kuhy-credit v0.3.1 (android_ui, workout_firebase_flow, app_icons,
archwiki_rag, artgate, code_tutor, js_anki, morning_routine,
phone_lease, random_jpg, sql_drills, vscode_optimizer). The repo has
no GUI, web app or game, so --help is the only surface.

morning_routine's unit runs /usr/bin/python, so its install.sh now
installs the requirements.txt pin there. Stdio/daemon entry points
stay without it; the evidence file lists each with the reason.

Also bumps Flutter to 3.50.1 and the stale Python pins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 10:17:38 +01:00

46 lines
1.4 KiB
Python

"""Every argparse/typer CLI in python_pkg ends its --help with the kuhy credit.
Each module runs as ``python -m <module> --help`` in a subprocess, the same
way kuhy and the systemd units start it, so the check covers the real entry
point rather than an internal parser builder.
"""
from __future__ import annotations
import subprocess
import sys
from kuhy_credit import credit_line
import pytest
# Entry points deliberately left without a credit, and why, live in
# docs/superpowers/evidence/kuhy-credit-cli-help-2026-11-21.json.
CREDITED_CLIS = (
"python_pkg.android_ui",
"python_pkg.android_ui.workout_firebase_flow",
"python_pkg.app_icons",
"python_pkg.archwiki_rag",
"python_pkg.artgate.cli",
"python_pkg.code_tutor.cli",
"python_pkg.js_anki",
"python_pkg.morning_routine._orchestrator",
"python_pkg.phone_lease",
"python_pkg.random_jpg.generate_jpeg",
"python_pkg.sql_drills",
"python_pkg.vscode_optimizer",
)
@pytest.mark.parametrize("module", CREDITED_CLIS)
def test_help_ends_with_credit(module: str) -> None:
"""``--help`` exits 0 and prints the shared credit line."""
result = subprocess.run(
[sys.executable, "-m", module, "--help"],
capture_output=True,
text=True,
timeout=30,
check=False,
)
assert result.returncode == 0, result.stderr
assert credit_line() in result.stdout