Repository navigation
test(#11248): fix notification 4xx mock + conflict_resolver stale redis attr - #11273
Merged
Merged
Conversation
…aise test passes (#11248) test_raises_on_4xx_response constructed aiohttp.ClientResponseError(None, None, status=400) — request_info=None makes str(exc) raise (it reads request_info.real_url), so the except block's logger.error(..., exc) crashed with a secondary exception before _send_webhook's real 're-raise' reached the caller, and pytest.raises(ClientResponseError) never saw the expected error. The service code is correct (log + raise); only the test's mock exception was malformed. Construct a proper RequestInfo (url/method/headers/real_url) so str(exc) works. Verified: notification_service_test now 45 passed on BOTH py3.10 and py3.12 (was 1 failed). One item off the #11248 test-remediation umbrella. black/isort clean.
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
3 tasks
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.
Thinking Path
Two items from the #11248 test-remediation umbrella, both confirmed real
test-rot (fail on both py3.10 and a py3.12 venv — not py-version artifacts;
the service code is correct in both cases):
aiohttp.ClientResponseError(None, None, status=400);request_info=Nonemakes
str(exc)raise inside the except-blocklogger.error("…: %s", url, exc),crashing before the service's real
raisere-surfaced the error, sopytest.raises(ClientResponseError)never saw it. Built a well-formedRequestInfo.ConflictResolverwas migrated toAsyncRedisClientMixin(usesself._redis+_get_redis()), but the teststill referenced the old
_redis_clientattribute (23×) →AttributeError+mock-redis injection that the code never read. Renamed
_redis_client → _redis.What Changed
notification_service_test.py— well-formedClientResponseError(realRequestInfo).test_conflict_resolver.py—_redis_client→_redis(23 occurrences).Verification
AttributeError→ 51 passed on py3.10 (init testsalso pass on py3.12).
py_compile+black --check -l120+isortclean on both.Model Used
Opus 4.8 (1M context)
Refs #11248 (checks off notification_service_test + test_conflict_resolver).