Expand offline SDK test coverage#14
Open
lopadova wants to merge 3 commits intoregolo-ai:masterfrom
Open
Conversation
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
This PR hardens the Python SDK test surface and removes the dependency on live API calls for the default test run.
httpx.MockTransport.Commits
ab0caf9 fix: retry transient POST server errorsb9de05a fix: use audio transcription model for instance calls575258c test: expand offline SDK coverageDetails
The previous test suite lived in a single
tests/test.pyfile and mixed a few mocked assertions with live API calls. That made the suite hard to run reliably in CI or on contributor machines because it depended onTEST_KEY, reachable Regolo services, currently available default models, and successful image/embedding/chat responses from the live API. It also called test functions directly at module import time, so tests could execute outside pytest's normal collection and skipping behavior.The new suite is fully offline by default. It uses
httpx.MockTransportto validate the exact request payloads, authorization headers, endpoint paths, and response parsing behavior without network access. This keeps the tests deterministic while still exercising the SDK's public methods and the HTTP boundary.Coverage was added for the gaps identified in the SDK audit:
run_chat.top_nboundary handling.rank_fields,return_documents, andmax_chunks_per_doc.While adding the tests, two small implementation issues were covered and fixed:
safe_postnow retries transient 5xx responses a limited number of times before raising, while preserving immediate failures for 401/429 and other non-retryable errors.RegoloClient.audio_transcription()now defaults to the instance audio transcription model instead of incorrectly falling back to the chat model.Tests