Skip to content

feat: doctest the forge and origin helpers, and run doctests in CI (#40) - #45

Merged
tschm merged 1 commit into
mainfrom
rhiza_fix_40_20260925
Sep 25, 2026
Merged

tschm merged 1 commit into
mainfrom
rhiza_fix_40_20260925

Conversation

@tschm

@tschm tschm commented Sep 25, 2026

Copy link
Copy Markdown
Member

Fixes #40

Acceptance criterion (verbatim):

each of forge.py and origin.py carries at least one doctest, and CI executes and passes them.

What changed

Examples. They go where the docstrings already make claims, so each one checks something the prose asserts:

  • forge.normalise_gitlab_status: failed → failure, case and whitespace ignored, manual → cancelled, and an unknown status → stale (the "never a fleet-wide red" promise).
  • origin.forge_for_host: gitlab.com and gitlab.* → gitlab; anything else, including an empty host → github.
  • origin.parse: the scp form; a nested GitLab namespace keeping every segment (the bug the module docstring describes); a path remote keeping only its tail; a one-segment path → None.

Wiring. collector/pyproject.toml adds jq_collector to testpaths and --doctest-modules to addopts. ci.yml is unchanged: its existing test step in collector (lint + tests), and the collector (tests, Python 3.11) job, now collect the doctests automatically. The same goes for a local uv run pytest.

Checks (run locally from collector/, as CI does)

  • uv run --frozen ruff check … / ruff format --check …: pass
  • tests on 3.12: 450 passed (447 + 3 doctest items: forge.py: 1, origin.py: 2), 100.00% coverage, floor met
  • tests on 3.11: 450 passed, 100.00%
  • Negative check: in a scratch copy with one expected output changed ('failure' → 'failed'), pytest exits 1 with FAILED jq_collector/forge.py::jq_collector.forge.normalise_gitlab_status.

Not addressed

Doctests for the other nine modules. The issue scoped this to the two pure helper modules; the rest mostly need a network client or a git checkout to say anything.

Merge note

#44 (the mypy gate) also edits collector/pyproject.toml, but in different hunks (the dev group line, and a new [tool.mypy] table). The two should merge in either order without conflict.

Closes #40

🤖 Generated with Claude Code

@tschm
tschm merged commit 2acdb53 into main Sep 25, 2026
5 checks passed
@tschm
tschm deleted the rhiza_fix_40_20260925 branch September 25, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add doctest examples to forge.py and origin.py and run them in CI

1 participant