Skip to content

test(coverage): omit pure typing module commitizen/question.py#1988

Open
bearomorphism wants to merge 1 commit intocommitizen-tools:masterfrom
bearomorphism:fix/1904-question-coverage
Open

test(coverage): omit pure typing module commitizen/question.py#1988
bearomorphism wants to merge 1 commit intocommitizen-tools:masterfrom
bearomorphism:fix/1904-question-coverage

Conversation

@bearomorphism
Copy link
Copy Markdown
Collaborator

Description

Excludes commitizen/question.py from coverage reporting by adding it to the [tool.coverage.report].omit list in pyproject.toml.

commitizen/question.py defines TypedDicts (Choice, ListQuestion, InputQuestion, ConfirmQuestion), Literal discriminators, and the CzQuestion union — pure static-typing constructs with no runtime code paths to exercise. Coverage therefore reports the file as 0%, which is misleading: the lines do not represent untested logic, they represent type definitions whose only consumers are type checkers.

How

  • Add ''commitizen/question.py'' to the omit list under [tool.coverage.report] in pyproject.toml.

Why

What

  • One-line addition to pyproject.toml. No source/test code changes.

Verification

  • Ran uv run poe cover locally; commitizen/question.py no longer appears in the coverage report. TOTAL coverage rises from the previous baseline accordingly (now 99%).
  • Ran uv run poe lintruff check and mypy both pass.
  • Ran uv run poe format — no files changed.

Checklist

Was generative AI tooling used to co-author this PR?

  • Yes (please specify the tool below)

Generated-by: GitHub Copilot CLI (Claude Opus 4.7) following the guidelines

Code Changes

  • Add test cases to all the changes you introduce — N/A (configuration-only change to coverage tool)
  • Run uv run poe all locally to ensure this change passes linter check and tests
  • Manually test the changes:
    • Verify the feature/bug fix works as expected in real-world scenarios — confirmed question.py is no longer reported by uv run poe cover
    • Test edge cases and error conditions — N/A
    • Ensure backward compatibility is maintained — coverage tool config only; no runtime impact
    • Document any manual testing steps performed — see Steps to Test below
  • Update the documentation for the changes — N/A (no user-facing behavior change)

Documentation Changes

N/A.

Expected Behavior

After this change, uv run poe cover no longer lists commitizen/question.py as 0% covered, because it is excluded from the coverage report along with the other entries in the omit list.

Steps to Test This Pull Request

  1. uv sync --frozen --group base --group test --group linters
  2. uv run poe cover
  3. Confirm that commitizen/question.py does not appear in the coverage report (previously it appeared as 7 7 0%).

Additional Context

Closes #1904.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider excluding pure typing modules from coverage (question.py)

1 participant