Skip to content

Attain 100% Coverage for tests/ directory #18470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 4, 2025

Conversation

miketheman
Copy link
Member

All the code is covered, also ensure all test code is executed during a test run.

Easier to review commit-by-commit, some commits have further descriptions as to their reasoning.

As a method for confirming that every line of the tests code is
executed.

Signed-off-by: Mike Fiedler <[email protected]>
Added in coverage 7.2.0, allowing extension to the defaults.

Refs: https://coverage.readthedocs.io/en/7.10.1/config.html#config-report-exclude-also

Signed-off-by: Mike Fiedler <[email protected]>
`pytest.fail` will fail a test case, with conditions
expected never to be reached.

Signed-off-by: Mike Fiedler <[email protected]>
Since the in-test logic relies on how Faker generates strings,
there is zero chance that both branches will ever be true in the context
of a single test run.

Replace the conditionals with `str.swapcase()`.

Signed-off-by: Mike Fiedler <[email protected]>
Signed-off-by: Mike Fiedler <[email protected]>
No tests use the `branch_id` field, so the condition is never met.

Signed-off-by: Mike Fiedler <[email protected]>
The test branch is being executed, but coverage isn't detecting it.

Refs: nedbat/coveragepy#2015

Signed-off-by: Mike Fiedler <[email protected]>
@miketheman miketheman added the testing Test infrastructure and individual tests label Aug 1, 2025
@miketheman miketheman requested a review from a team as a code owner August 1, 2025 20:20
@miketheman miketheman merged commit f1820e0 into pypi:main Aug 4, 2025
20 checks passed
@miketheman miketheman deleted the miketheman/tests-coverage branch August 4, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Test infrastructure and individual tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants