Skip to content

Add e2e SDK tests and fill adapter/stats unit test gaps#32

Merged
msrdic merged 3 commits into
mainfrom
codex/fix-codex-hook-stats
Apr 16, 2026
Merged

Add e2e SDK tests and fill adapter/stats unit test gaps#32
msrdic merged 3 commits into
mainfrom
codex/fix-codex-hook-stats

Conversation

@msrdic
Copy link
Copy Markdown
Owner

@msrdic msrdic commented Apr 16, 2026

Summary

  • New file tests/test_e2e_sdk.py: real-API end-to-end tests for the Anthropic, OpenAI, and LiteLLM adapters (including acompletion). Tests skip automatically when the relevant env var (ANTHROPIC_API_KEY, OPENAI_API_KEY) is absent. Adds an e2e pytest marker for selective inclusion/exclusion (pytest -m e2e / pytest -m "not e2e").
  • TestLiteLLMAdapter: two new tests verifying completion() and acompletion() raise ImportError with the right message when litellm is not installed.
  • TestRecord: concurrent-writes test spinning up 100 threads to verify the append-only binary stats log is race-free under load.
  • TestHookStatsIntegration: 5 new tests confirming that Claude Code and Codex hooks actually write to the stats log on each invocation — curt/polite classification, pass-through counting, and multi-call accumulation.

Test plan

  • pytest -m "not e2e" passes (all unit tests, no API calls)
  • pytest -m e2e passes with ANTHROPIC_API_KEY and OPENAI_API_KEY set
  • pytest -m e2e -k litellm passes with OPENAI_API_KEY set

🤖 Generated with Claude Code

msrdic and others added 3 commits April 16, 2026 08:20
Remove unused import in test_write_failure_is_ignored; add
.pre-commit-config.yaml with ruff check+format hooks to catch
this class of issue locally before CI.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@msrdic msrdic merged commit fd437fa into main Apr 16, 2026
5 checks passed
@msrdic msrdic deleted the codex/fix-codex-hook-stats branch April 16, 2026 12:07
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.

1 participant