test: add unit tests for the docs scripts - #494
shenxianpeng wants to merge 1 commit into
Conversation
Cpp-Linter Report
|
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.
32668e1 to
af9b148
Compare
|
It seems there is no need to add tests for the badge hook and docs. closing. |
Summary
This PR adds unit tests for the docs scripts, which raises coverage. It changes nothing else.
docs/*.py, the only Python in the repository, goes from 0% (no tests) to 100% line and branch coverage (coverage.py withbranch = trueandsource = ["docs"]).tests/test_gen_io_doc.pyrunsdocs/gen_io_doc.pythe way mkdocs-gen-files does. It checks that every input and output inaction.ymlis 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.pycovers every badge type indocs/badge_hook.pyand its error paths.testdependency group (pytest and coverage;uv.lockonly gains these packages), pytest and coverage settings inpyproject.toml, and aRun testsworkflow. Run them locally withuv run --group test pytest.@mainreusable workflows and./stay as they are.actions/checkoutstep already setspersist-credentials: false, exceptrelease.yml, which needs the credentials to push the rolling tag.Related Issues
None.