Repository navigation
Test _send's answer handling: silent 201, other 2xx, unreadable error body - #15
Merged
Merged
Conversation
… body The README promises "A 201 is success; anything else is logged at DEBUG and dropped", but only the HTTPError path (401) was exercised. Lock in that a 201 logs nothing, that a 200/204 is logged as not delivered, and that an error answer whose body read fails still logs its status without killing the sender thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (Stage B, unit-test expansion; anchored on CI run 38532190743):
Judgment call flagged for a human reviewer:
Summary: a tests-only PR with green CI on the whole matrix. It is ready for human review and merge. This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
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
Stage B (unit-test expansion) cycle, scoped to
TraceClient._send's handling of the server's answer. The README's wire-format section promises "A201is success; anything else is logged atDEBUGand dropped". Until now only theHTTPErrorpath (a 401) was tested, which left three branches without a test:test_a_201_is_delivered_without_logging_anything: success is silent on thetracelogger.test_a_success_status_other_than_201_is_logged_as_not_delivered: a 200 or a 204 goes through the non-errorurlopenpath and reaches thestatus != 201log line.test_an_error_answer_whose_body_cannot_be_read_still_logs_its_status: anHTTPErrorwhoseread()raises is swallowed, its status (503) is still logged at DEBUG, and the sender thread does not die (threading.excepthookis never called).These are characterization tests only. No production code changed, and all three tests pass against the current behavior.
Test plan
python3 -m unittest -vlocally on Python 3.8.10:Ran 48 tests,OKstatus != 201temporarily changed tostatus >= 300and the innertryaroundanswered.read()removed, the two branch tests failed (FAILED (failures=2)). The source was then restored.Buildgreen on 3.8 / 3.10 / 3.12Notes
urllib.error,urllib.request), and only in the test module.This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson