Add e2e SDK tests and fill adapter/stats unit test gaps#32
Merged
Conversation
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>
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
tests/test_e2e_sdk.py: real-API end-to-end tests for the Anthropic, OpenAI, and LiteLLM adapters (includingacompletion). Tests skip automatically when the relevant env var (ANTHROPIC_API_KEY,OPENAI_API_KEY) is absent. Adds ane2epytest marker for selective inclusion/exclusion (pytest -m e2e/pytest -m "not e2e").TestLiteLLMAdapter: two new tests verifyingcompletion()andacompletion()raiseImportErrorwith the right message whenlitellmis 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 e2epasses withANTHROPIC_API_KEYandOPENAI_API_KEYsetpytest -m e2e -k litellmpasses withOPENAI_API_KEYset🤖 Generated with Claude Code