Repository navigation
fix: type-check session in fake cancel_timer and fetch_unprocessed - #246
Merged
Merged
Conversation
FakeOutboxClient ignored the session argument, so TestOutboxBroker accepted session=None or a random object where OutboxClient raises TypeError. The fake now calls the same require_session_or_connection guard. A contract test runs the check against both clients.
Benchmark gate✅ gate passed
Gated (fails the build): |
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.
FakeOutboxClient.cancel_timerandfetch_unprocesseddropped thesessionargument without looking at it.OutboxClientcallsrequire_session_or_connectionfirst, so underTestOutboxBrokera call withsession=Noneorsession=object()passed, while the same call raisesTypeErrorin production.The fake now calls the same guard with
FakeOutboxClient.<method>as the context, so its message has the same shape as the real client's.tests/test_client_contract.pycalls both methods withNoneandobject()on the fake and real clients. It failed on the fake before the fix. The suite's docstring scope line now mentions it.tests/test_fake.pytests passedsession=object()behind aty: ignore. They now passfake_session().docs/usage/testing.mdsaid the session is ignored in tests. It now says it must still be anAsyncSessionorAsyncConnection.Follow-up to #244, whose review found the gap.
just lintis clean;just test: 762 passed.