Skip to content

test: add unit tests for the docs scripts - #494

Closed
shenxianpeng wants to merge 1 commit into
mainfrom
chore/repo-health-check
Closed

shenxianpeng wants to merge 1 commit into
mainfrom
chore/repo-health-check

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR adds unit tests for the docs scripts, which raises coverage. It changes nothing else.

  • Coverage: docs/*.py, the only Python in the repository, goes from 0% (no tests) to 100% line and branch coverage (coverage.py with branch = true and source = ["docs"]).
    • tests/test_gen_io_doc.py runs docs/gen_io_doc.py the way mkdocs-gen-files does. It checks that every input and output in action.yml is documented with its version, default and description. It also covers how each kind of metadata is rendered, the annotation for an undocumented field, and the build failures for incomplete metadata.
    • tests/test_badge_hook.py covers every badge type in docs/badge_hook.py and its error paths.
    • To run them, there is a test dependency group (pytest and coverage; uv.lock only gains these packages), pytest and coverage settings in pyproject.toml, and a Run tests workflow. Run them locally with uv run --group test pytest.
  • SHA pinning: nothing to change. All tag references were already pinned to commit SHAs; the @main reusable workflows and ./ stay as they are.
  • Checkout credentials: nothing to change. Every actions/checkout step already sets persist-credentials: false, except release.yml, which needs the credentials to push the rolling tag.

Related Issues

None.

@shenxianpeng shenxianpeng added the maintenance Maintenance updates label Oct 1, 2026
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format (v16.0.6) reports: 2 file(s) not formatted
  • docs/examples/demo/demo.hpp
  • docs/examples/demo/demo.cpp
clang-tidy (v16.0.6) reports: 7 concern(s)

Have any feedback or feature suggestions? Share it here.

Cover docs/gen_io_doc.py (the generated inputs-outputs page) and
docs/badge_hook.py (the md:* badges) with pytest, including a check that
every action input and output is documented. Add a test dependency group,
pytest and coverage settings, and a workflow that runs the tests when the
action metadata, the docs scripts or the tests change.
@shenxianpeng
shenxianpeng force-pushed the chore/repo-health-check branch from 32668e1 to af9b148 Compare October 2, 2026 19:35
@shenxianpeng shenxianpeng changed the title chore: repository health check (tests, security, deps, CI) test: add unit tests for the docs scripts Oct 2, 2026
@shenxianpeng shenxianpeng removed the documentation Improvements or additions to documentation label Oct 2, 2026
@shenxianpeng

Copy link
Copy Markdown
Member Author

It seems there is no need to add tests for the badge hook and docs. closing.

@shenxianpeng
shenxianpeng deleted the chore/repo-health-check branch October 2, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Maintenance updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant