test: respx suite at the HTTP boundary; type-check tests (ratchet resolved)#57
Merged
Merged
Conversation
…olved) Implements plans/refactor/06-test-suite-http-boundary.md: - Add respx (dev). New shared fixtures: mock_api (respx router on the test base URL) and sdk (opened CodesphereSDK against it) - tests/test_exceptions.py: full raise_for_status matrix over real httpx.Response objects (status->class for every exported exception, message-key extraction incl. joined error lists, non-JSON bodies, Retry-After parsing incl. non-numeric, APIError request context and __str__), default constructors for all 10 exception classes, plus end-to-end error surfacing through the real transport (404/429/ timeout/connect) - tests/core/test_execute_operation.py: executor behavior on the real wire — URL building from path params, auth header, input_model validation stopping bad payloads before any request, empty-dict body regression, NoneType responses, response validation, and bound ResourceList items making follow-up calls - tests/test_http_client.py: transport lifecycle (idempotent open, close-without-open), the full httpx->SDK error mapping matrix, timeout/stream_timeout properties, stream() passthrough - Coverage: exceptions/config/http_client at 100%, core/handler at 96% - ty ratchet fully resolved: tests/ removed from [tool.ty.src] exclude; the whole repo (src + tests) now type-checks. Fallout fixed properly where real (env_vars set/delete annotations didn't admit list[EnvVar]; isinstance narrowing in delete; typed workspace configs in the integration conftest) and suppressed surgically where ty is wrong (pytest.skip/fail signature resolution, funneled through skip_test/ fail_test helpers) - CONTRIBUTING.md documents the mocking policy: new tests mock the transport (respx), never SDK internals
🛡️ Bandit Security Scan Results✅ No security issues found by Bandit. |
Pytest Coverage ReportTest Execution Summary
|
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.
Implements plans/refactor/06-test-suite-http-boundary.md: