Skip to content

Raise unit test coverage from 61% to 81%, wire integration coverage into codecov - #5

Merged
amrit110 merged 2 commits into
mainfrom
test-coverage-90
Aug 31, 2026
Merged

Raise unit test coverage from 61% to 81%, wire integration coverage into codecov#5
amrit110 merged 2 commits into
mainfrom
test-coverage-90

Conversation

@amrit110

Copy link
Copy Markdown
Member

Summary

  • client.py had zero unit tests despite being pure stdlib and fully mockable. New tests/unit/test_client.py (31 tests) covers header/body construction (session-affinity + tenant headers), all server-error → tabctx-exception mappings, 503 backpressure retry/backoff, and response parsing.
  • Filled small coverage gaps across engine.py, batching.py, cache/manager.py, cache/policies.py (new test_cache_policies.py), cache/spill.py, memory/adaptive.py, memory/estimator.py, serve/csv_io.py, serve/uploads.py, serve/factory.py, and backends/fake.py (new test_fake_backend.py) — all now at 100%.
  • backends/tabicl.py / backends/tabpfn.py need a real GPU or licensed weights and are never installed by any CI job (unit_tests.yml runs uv sync --dev; integration_tests.yml installs .[serve,dev] — neither pulls in torch/tabicl/tabpfn). Omitted from the coverage metric via pyproject.toml's [tool.coverage.run] rather than carrying a permanent, meaningless 0%.
  • serve/app.py (249 lines) is only exercised by the integration suite (a real 2-replica Ray Serve cluster) — wired --cov collection into integration_tests.yml and added codecov flags (unit/integration) so the combined project number on codecov reflects that real coverage instead of the unit job's 0% for this one file. Verified locally: the integration suite alone brings app.py to 41%.

Net result: tests/unit coverage 61% → 81% (150 → 234 tests), with the honest remaining gap (serve/app.py) now covered by the integration job's own upload rather than hidden.

No functional bugs were found in review. One defensive, unreachable-in-practice guard in csv_io.py (X/y row-count mismatch after independent parsing of the same file) is marked # pragma: no cover, matching the existing pattern already used in client.py for a similar defensive branch.

Test plan

  • uv run pytest tests/unit --cov tabctx --cov-report=term-missing -q — 234 passed, 81% coverage
  • uv run ruff check src/tabctx tests/unit — clean
  • uv run ruff format --check src/tabctx tests/unit — clean
  • Verified integration_tests.yml's new coverage command locally (.venv/bin/python -m pytest tests/integration --cov tabctx ...) — 22 passed, brings serve/app.py to 41%
  • YAML/TOML syntax of edited config files validated

🤖 Generated with Claude Code

https://claude.ai/code/session_011JfxoF3j54JyZDXNRsjj39

amrit110 and others added 2 commits August 31, 2026 10:45
… into codecov

client.py had zero unit tests despite being pure stdlib and fully
mockable -- new test_client.py (31 tests) covers header/body
construction, error-status mapping, and 503 backpressure retry.
Small gaps filled across engine, batching, cache (manager/policies/
spill), memory estimators, and serve (csv_io/uploads/factory), all
now at 100%.

backends/tabicl.py and backends/tabpfn.py need a real GPU or
licensed weights and are never installed by any CI job by design;
omitted from the coverage metric (pyproject.toml) rather than
carrying a permanent, meaningless 0%.

serve/app.py is only exercised by the integration suite (a real
Ray Serve cluster) -- wired coverage collection into
integration_tests.yml and added codecov flags (unit/integration)
so the combined "overall" number on codecov reflects that real
coverage instead of unit-only 0%.

No functional bugs found; one defensive, unreachable-in-practice
check in csv_io.py marked # pragma: no cover, matching the
existing pattern in client.py.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011JfxoF3j54JyZDXNRsjj39
…railing newline

integration_tests.yml installs via `.[serve,dev]` (the optional-
dependencies extra), which was missing pytest-cov -- only the separate
[dependency-groups] dev (used by `uv sync --dev` in unit_tests.yml) had
it. The new --cov flags in integration_tests.yml then failed with
"unrecognized arguments: --cov".

benchmarks/baselines/v0.9.1-research-1replica.json (added in a prior
commit that didn't touch any code_checks.yml-watched path, so pre-commit
never ran on it) was missing a trailing newline; code_checks.yml runs
pre-commit on the whole repo once a PR touches *.py/pyproject.toml, so
it now surfaces here.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011JfxoF3j54JyZDXNRsjj39
@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@amrit110
amrit110 merged commit 76bbad3 into main Aug 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants