Coverage cleanup: _constants 100%, soa 100%, __init__ 98%#250
Merged
Conversation
tests/test_constants.py: reload checkdmarc._constants under a patched environment and assert each cache-size / cache-age env var override lands on the corresponding constant. Covers CACHE_MAX_LEN, CACHE_MAX_AGE_SECONDS, and the per-subsystem DNS_/DNSSEC_/SMTP_ overrides. tests/test_soa.py: cover the empty-local-part RNAME branch (``.example.com.``), the non-integer u32 field branch, the out-of-range u32 branch, and the check_soa parse-error branch (where get_soa_record succeeds but parse_soa_string raises, returning an error result that still carries the original record). tests/test_init.py: cover the empty-string filter inside check_domains, the MTA-STS-policy-mx-patterns propagation to check_mx, the BIMI-error CSV-row branch that flattens l/a tag values to bimi_l / bimi_a columns, and the TLS / STARTTLS KeyError fallback for MX hosts without those keys (e.g. when skip_tls=True). Per-file coverage: _constants.py 79% -> 100% soa.py 89% -> 100% __init__.py 92% -> 98% 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
Last cleanup pass on the small per-file coverage gaps that earlier rounds skipped.
_constants.pysoa.py__init__.pyTests added
tests/test_constants.py—TestEnvironmentOverrideBranchesreloadscheckdmarc._constantsunder apatch.dict(os.environ, ...)context and asserts that each cache-size and cache-age env var (CACHE_MAX_LEN,CACHE_MAX_AGE_SECONDS, plus the per-subsystemDNS_*,DNSSEC_*,SMTP_*overrides) lands on the corresponding constant.tearDownrestores the module so test ordering is unaffected.tests/test_soa.py— covers the empty-local-part RNAME branch (e.g..example.com.), the non-integer u32 field branch, the out-of-range u32 branch, and thecheck_soaparse-error branch (whereget_soa_recordsucceeds butparse_soa_stringraises — the failure result still carries the original record).tests/test_init.py— empty-string filter insidecheck_domains, MTA-STS-policy mx-pattern propagation tocheck_mx, BIMI-error CSV row flatteningl/atag values tobimi_l/bimi_acolumns, and the TLS / STARTTLSKeyErrorfallback for MX hosts without those keys (e.g. whenskip_tls=True).Test plan
GITHUB_ACTIONS=true python -m pytest tests/passes (439 passed, 12 skipped)ruff check,ruff format --check,pyright(1.1.409) all clean🤖 Generated with Claude Code