test(coverage): omit pure typing module commitizen/question.py#1988
Open
bearomorphism wants to merge 1 commit intocommitizen-tools:masterfrom
Open
test(coverage): omit pure typing module commitizen/question.py#1988bearomorphism wants to merge 1 commit intocommitizen-tools:masterfrom
bearomorphism wants to merge 1 commit intocommitizen-tools:masterfrom
Conversation
commitizen/question.py defines TypedDicts, Literal aliases, and a union type used purely for static typing. It has no runtime code paths to exercise, so excluding it from the coverage report removes a misleading 0% line and reflects its purpose more accurately. Closes commitizen-tools#1904 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Excludes
commitizen/question.pyfrom coverage reporting by adding it to the[tool.coverage.report].omitlist inpyproject.toml.commitizen/question.pydefines TypedDicts (Choice,ListQuestion,InputQuestion,ConfirmQuestion),Literaldiscriminators, and theCzQuestionunion — pure static-typing constructs with no runtime code paths to exercise. Coverage therefore reports the file as0%, which is misleading: the lines do not represent untested logic, they represent type definitions whose only consumers are type checkers.How
''commitizen/question.py''to theomitlist under[tool.coverage.report]inpyproject.toml.Why
0%coverage row for a file that has no runtime behavior to test.What
pyproject.toml. No source/test code changes.Verification
uv run poe coverlocally;commitizen/question.pyno longer appears in the coverage report.TOTALcoverage rises from the previous baseline accordingly (now99%).uv run poe lint—ruff checkandmypyboth pass.uv run poe format— no files changed.Checklist
Was generative AI tooling used to co-author this PR?
Generated-by: GitHub Copilot CLI (Claude Opus 4.7) following the guidelines
Code Changes
uv run poe alllocally to ensure this change passes linter check and testsquestion.pyis no longer reported byuv run poe coverDocumentation Changes
N/A.
Expected Behavior
After this change,
uv run poe coverno longer listscommitizen/question.pyas0%covered, because it is excluded from the coverage report along with the other entries in theomitlist.Steps to Test This Pull Request
uv sync --frozen --group base --group test --group lintersuv run poe covercommitizen/question.pydoes not appear in the coverage report (previously it appeared as7 7 0%).Additional Context
Closes #1904.