Skip to content

test(coverage): add pragma no cover + coverage gap tests → 98%#26

Merged
orvi2014 merged 2 commits into
mainfrom
test/router-coverage-suite
May 12, 2026
Merged

test(coverage): add pragma no cover + coverage gap tests → 98%#26
orvi2014 merged 2 commits into
mainfrom
test/router-coverage-suite

Conversation

@orvi2014

Copy link
Copy Markdown
Owner

Summary

  • Added # pragma: no cover to 20+ genuinely untestable branches (ImportError re-raises for optional deps, abstract NotImplementedError bodies, BaseException cleanup handlers, retry sleep, import-time version fallback)
  • Added tests/test_coverage_gaps.py (32 new tests) targeting every remaining uncovered path: budget edge cases, models cache exceptions, async router paths, stream affordability/downgrade/failover, LangChain callback warning branches, Vercel _last_step_info, and telemetry CLI flags
  • Full suite: 432 tests, 0 failures, 98% coverage (up from 86% on main)

Coverage breakdown

File Before After
baar/__init__.py 100%
baar/core/budget.py 100%
baar/core/models.py 100%
baar/router.py ~60% 98%
baar/core/router.py 97%
TOTAL 86% 98%

Test plan

  • pytest tests/test_coverage_gaps.py → 32 passed
  • pytest --cov=baar --cov-report=term-missing → 432 passed, 98% total

🤖 Generated with Claude Code

Add # pragma: no cover to truly untestable branches (ImportError re-raises
for optional deps, abstract NotImplementedError bodies, BaseException cleanup
handlers, retry sleep, import-time version fallback).

Add tests/test_coverage_gaps.py (32 tests) targeting every remaining uncovered
path: budget edge cases, models cache exceptions, async router paths, stream
affordability/downgrade/failover, langchain callback warning branches, vercel
_last_step_info, and telemetry CLI flags.

Result: 86% → 98% coverage (432 tests, 0 failures).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@orvi2014 orvi2014 force-pushed the test/router-coverage-suite branch from 6fee30d to 321888f Compare May 12, 2026 00:05
…talled

Mirrors the pattern in test_langchain_integration.py — pytest.importorskip
at module level so CI on Python 3.10 (where langchain-core is absent) skips
gracefully rather than erroring with ImportError.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@orvi2014 orvi2014 merged commit 55041b9 into main May 12, 2026
3 checks passed
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@orvi2014 orvi2014 deleted the test/router-coverage-suite branch May 12, 2026 00:10
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