Skip to content

test: raise unit test coverage to 100% across all SDK modules#113

Merged
zeevdr merged 1 commit into
mainfrom
issue/112-coverage
May 28, 2026
Merged

test: raise unit test coverage to 100% across all SDK modules#113
zeevdr merged 1 commit into
mainfrom
issue/112-coverage

Conversation

@zeevdr
Copy link
Copy Markdown
Member

@zeevdr zeevdr commented May 28, 2026

Summary

  • Coverage had reached 97.52% from prior work but 23 statements across 6 modules remained uncovered; this PR closes every gap to reach 100%.
  • The missing branches were edge-case paths: spurious async-event wakes, deadline-budget exhaustion in the async retry loop, stream-loop bodies that existing tests never exercised (all mocks used empty streams), early-return paths when a watcher is stopped mid-error, and the fallback branch in the TypedValue match.
  • Hitting 100% removes the risk of undetected regressions in these exact paths, which include production-critical reconnect and error-handling logic.

Test plan

  • _channel.py: capture and invoke the inner callback to confirm Bearer header injection
  • _convert.py: fake TypedValue with unknown kind to exercise the fallback case
  • _retry.py: two async deadline tests (loop-top break; sleep clipped to remaining budget)
  • async_client.py: UserWarning for insecure+token; get_server_version() caching; check_version=True lazy path
  • async_watcher.py: spurious-wake in changes(); stream loop body; AioRpcError while stopped
  • watcher.py: queue-cond wait when empty; stream loop body; RpcError while stop_event set
  • make lint passes (ruff check + format)
  • make test: 282 passed, 13 skipped, total coverage 100%

Closes #112

Adds targeted tests for every previously uncovered branch, covering the 23
missing statements that were keeping coverage below perfection:

- _channel.py: invoke the _token_call_credentials inner callback directly
- _convert.py: hit the case-_ fallback in typed_value_to_string via a fake TypedValue
- _retry.py: async deadline tests — loop-top break (line 116) and sleep-clipping (line 130)
- async_client.py: insecure-token UserWarning, get_server_version() caching, and the
  check_version=True lazy-compat path
- async_watcher.py: spurious-wake path in changes(), stream loop body (process_change
  + stopped-mid-iteration return), and AioRpcError while _stopped=True
- watcher.py: queue-cond wait when queue is empty, stream loop body (process_change
  + stopped-mid-iteration return), and RpcError while stop_event set

All 282 tests pass; total coverage 100% (927/927 statements).

Closes #112

Co-Authored-By: Claude <noreply@anthropic.com>
@zeevdr zeevdr added size: L Larger effort — multiple days, design decisions needed priority: P2 Nice-to-have labels May 28, 2026
@zeevdr zeevdr added this to the Beta Readiness milestone May 28, 2026
@zeevdr zeevdr changed the title test: raise coverage to 100% test: raise unit test coverage to 100% across all SDK modules May 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@zeevdr zeevdr merged commit 92e944b into main May 28, 2026
15 checks passed
@zeevdr zeevdr deleted the issue/112-coverage branch May 28, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: P2 Nice-to-have size: L Larger effort — multiple days, design decisions needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Raise unit test coverage from 52% to 95% across SDK modules

1 participant