test: 100% coverage + CI coverage gate#208
Conversation
Raise unit coverage from 95% line / 99% branch to 100% line + branch
with meaningful tests (not coverage-gaming), and wire a hard gate into
CI so it cannot regress.
Tests added:
- test_percy_automate.py: full coverage of the previously-untested
PercyOnAutomate class (invalid driver, disabled, name/options
validation, alt camelCase region-key normalisation + id extraction,
and the swallow-and-return-None error path).
- test_init.py: defensive percy_snapshot/percy_screenshot import
fallbacks that surface a helpful "package not installed" error.
- cli_wrapper: old-CLI-minor-version rejection, unsuccessful
healthcheck, post_failed_event error swallow, and post_poa_screenshots
success + error paths.
- app_automate: remote-uploads-disabled fallback, begin() JSON parse,
execute_percy_screenshot error path, and screenshot re-raise after a
failure notification.
- app_percy: sync / test_case / th_test_case_execution_id type guards.
- generic_provider: full-page falls back to single page.
- metadata: remote_url new-client path and old-client URL fallback.
- android_metadata: malformed viewportRect falls back to the driver.
Instrumentation:
- Add .coveragerc (branch=True, fail_under=100, show_missing).
- Add coverage to development.txt; Makefile `coverage` now reports and
enforces the threshold instead of only emitting HTML.
- CI (test.yml) runs `make coverage` across the Python matrix, turning
the gate red on any drop below 100%.
- percy_options: mark two genuinely-unreachable branch arcs with
`# pragma: no branch` (options is always {} when those guards run).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the branch-coverage gate and the two no-branch pragmas in
percy_options. Every line is executed by real unit tests; the only
branch arcs that pragma silenced were unreachable (control reaches
those guards only when options is {}), so line coverage at 100% is the
honest, pragma-free gate.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The org-managed 'Automatic Dependency Submission' workflow runs setup-python against .python-version; the pinned patch 3.10.3 is not available on the GitHub Ubuntu runner, failing the check on every push. 3.10 (latest available patch) matches the sibling SDKs and resolves it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude Code PR ReviewPR: #208 • Head: db34cf5 • Reviewers: stack:code-reviewer SummaryAdds unit tests across seven modules (app_automate, generic_provider, cli_wrapper, android_metadata, metadata, percy_automate, app_percy/init) covering previously-untested error, fallback, and edge-case paths, and introduces a CI coverage gate: a new Review Table
FindingsNo Critical or High findings. Two non-blocking, low-severity observations:
Verdict: PASS |
What & why
This SDK had no coverage enforcement in CI and sat at ~95% line locally. This PR raises it to 100% line coverage with meaningful tests and wires a hard CI gate so coverage can't silently regress.
Tests added
PercyOnAutomate(was untested)Noneerror path — newtests/test_percy_automate.pypercy/__init__.pypercySnapshotalias +percy_snapshot/percy_screenshotimport fallbacks (the latter via a reload-based test) — newtests/test_init.pycli_wrapperpost_failed_eventerror swallow,post_poa_screenshotssuccess + errorapp_automatebegin()JSON parse,execute_percy_screenshoterror, re-raise after failure notificationapp_percysync/test_case/th_test_case_execution_idtype guardsgeneric_providermetadataremote_urlnew-client path + old-client URL fallbackandroid_metadataviewportRectfalls back to driver barsInstrumentation / gate
.coveragerc—source = percy,fail_under = 100,show_missing.coverageadded todevelopment.txt;make coveragereports and enforces the threshold.test.ymlrunsmake coverageacross the3.9 / 3.11 / 3.12matrix → red on any drop below 100%.Verification
🤖 Generated with Claude Code