Raise unit test coverage from 61% to 81%, wire integration coverage into codecov - #5
Merged
Conversation
… 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
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 ☂️ |
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
client.pyhad zero unit tests despite being pure stdlib and fully mockable. Newtests/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.engine.py,batching.py,cache/manager.py,cache/policies.py(newtest_cache_policies.py),cache/spill.py,memory/adaptive.py,memory/estimator.py,serve/csv_io.py,serve/uploads.py,serve/factory.py, andbackends/fake.py(newtest_fake_backend.py) — all now at 100%.backends/tabicl.py/backends/tabpfn.pyneed a real GPU or licensed weights and are never installed by any CI job (unit_tests.yml runsuv sync --dev; integration_tests.yml installs.[serve,dev]— neither pulls in torch/tabicl/tabpfn). Omitted from the coverage metric viapyproject.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--covcollection intointegration_tests.ymland added codecovflags(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 bringsapp.pyto 41%.Net result:
tests/unitcoverage 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 inclient.pyfor a similar defensive branch.Test plan
uv run pytest tests/unit --cov tabctx --cov-report=term-missing -q— 234 passed, 81% coverageuv run ruff check src/tabctx tests/unit— cleanuv run ruff format --check src/tabctx tests/unit— cleanintegration_tests.yml's new coverage command locally (.venv/bin/python -m pytest tests/integration --cov tabctx ...) — 22 passed, bringsserve/app.pyto 41%🤖 Generated with Claude Code
https://claude.ai/code/session_011JfxoF3j54JyZDXNRsjj39