tests: gate semvertag at 100% statement + branch coverage#1
Merged
Conversation
Cover every reachable path in the semvertag package and the shared CI descriptor gate, then lock the level in with fail_under = 100 so it can't regress. - _use_case: dict-dispatch in _compute_new_version drops the dead ValueError on the Bump.NONE-already-filtered branch - _transport: while-True + explicit counter eliminates the unreachable "for loop completed naturally" exit branch - __main__: drop the OSError(EPIPE) handler — Python 3.3+ auto-dispatches EPIPE to BrokenPipeError, so the OSError arm is unreachable - new tests/integration/test_cli_errors.py covers --version (incl. PackageNotFoundError fallback), every CLI override flag, the ValidationError / ValueError→ConfigError paths, ImportError / BrokenPipeError / SemvertagError from the use case, resilient-parsing early return, and the main() entry point - gitlab provider tests cover unknown HTTP status, Link headers with empty URI / non-next rel / missing rel - apply_cli_overlay nesting-depth>2 covered in unit tests - pyyaml moved into dev deps; the importorskip workaround and `ty: ignore` go away; main() of the descriptor gate gets two new tests - pyproject narrows --cov to semvertag + the two descriptor gate modules, makes --cov-branch the default, and sets fail_under = 100; redundant `just test-branch` removed Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…erage scope Address review findings on the 100% coverage gate PR: - test_cli_errors: replace MagicMock.assert_not_called() on a never-touched attribute with a monkeypatch that fails the test if `Settings` is constructed, giving the resilient_parsing branch a real assertion instead of a vacuous one. - test_cli_errors: type `_RaisingUseCase.__call__` as `typing.NoReturn` (it always raises) and drop the now-unused `RunResult` import. - pyproject: remove `--cov=tests.test_ci_descriptor_gate` from addopts — the file is plain test code with no pragmas/skips, so measuring its coverage produces no signal. `--cov=tests._descriptor_gate` (the script) stays. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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.
Summary
semvertag/and the shared CI descriptor gate to 100% statement + branch coverage and lock the level in viafail_under = 100so it can't regress.ValueErrorin_use_case, the for-loop natural-exit in_transport, and the redundantOSError(EPIPE)handler in__main__— Python 3.3+ already routes EPIPE toBrokenPipeError).pyyamlto a real dev dep so the descriptor-gate tests stop silentlyimportorskip-ing in CI, and add the missing tests for the gate'smain()entrypoint.Test plan
just lint-ci— clean (ruff, ty, eof-fixer)just test— 363 passed, coverage 100% / 100% branch,fail_under = 100satisfiedjust test --cov-report xml(CI's invocation) — clean, XML writtenuv run python -m tests._descriptor_gate templates/semvertag.yml— exits 0mkdocs build --strict— clean🤖 Generated with Claude Code