test: LangGraph integration tests (Groq, Gemini, mock)#16
Merged
Conversation
Tests three scenarios: - TestLangGraphGroqIntegration: real Groq API via openai client (OpenAI-compatible endpoint), skipped without GROQ_API_KEY - TestLangGraphGeminiIntegration: real Gemini API via LiteLLM, skipped without GEMINI_API_KEY - TestLangGraphMockIntegration: 5 end-to-end tests with mocked OpenAI client — always run, no API keys needed Each class covers: single-node tracking, multi-node accumulation, budget enforcement, nested budget propagation. Mock class also tests conditional retry-loop graphs. Also adds langgraph to dev dependencies so tests run in CI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…bundled pricing Groq's llama-3.1-8b-instant has no bundled price table in shekel, so max_usd=0.000001 alone never triggers BudgetExceededError (cost = $0). Adding price_per_1k_tokens forces non-zero cost calculation and makes the enforcement assertion reliable across all providers. 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/integrations/test_langgraph_integration.pywith 14 tests covering LangGraph + shekel budget trackinglanggraphto dev dependencies so tests run in CITest classes
TestLangGraphGroqIntegration(5 tests, skip withoutGROQ_API_KEY)Uses
openai.OpenAI(base_url="https://api.groq.com/openai/v1")inside real LangGraph nodes — shekel's OpenAI patch captures spend automatically.TestLangGraphGeminiIntegration(4 tests, skip withoutGEMINI_API_KEY)Uses
litellm.completion(model="gemini/gemini-2.0-flash")inside LangGraph nodes — shekel's LiteLLM patch captures spend automatically.TestLangGraphMockIntegration(5 tests, always run)Mocked OpenAI client, exercises the full patch→graph path end-to-end without API keys.
Scenarios covered per class
BudgetExceededErrorpropagation out of graphTest plan
GROQ_API_KEY/GEMINI_API_KEYsecrets🤖 Generated with Claude Code