Merged
Conversation
`has_pending` returned `True` for any input under `TestTimersBroker` because `mock_client.zscore` was an unstubbed `AsyncMock` and `score is not None` evaluated to a truthy mock. `cancel_all` would also have failed: `client.pipeline(...)` returned an awaitable mock that could not be entered with `async with`. The test broker's contract is "messages deliver immediately, so no timer is ever pending." Make the inspection paths reflect that: - `mock_client.zscore.return_value = None` → `has_pending` returns `False`. - `mock_client.zrangebyscore.return_value = []` (already set) → `get_pending_timers` returns `[]`. - Stub the pipeline so `cancel_all` returns `0`. Use `MagicMock` for the `pipeline()` call (returns the AsyncMock directly) and set `__aenter__.return_value = mock_pipe` so `async with ... as pipe` binds the same mock that exposes `execute() -> [0]`. Add a regression test in `tests/test_fake.py` and document the new contract in `docs/usage/testing.md`.
…tivation - basic.md: mark `client` as required for production. The previous `None` default suggested the broker was usable without one — it raises `IncorrectState` on the first operation. Point readers at the testing page for the no-client shape. - subscriber.md: replace `broker = TimersBroker()` in the timer-id example with the prod-flavoured `Redis.from_url(...)` snippet used on every other page (was the only no-client example outside the testing docs). - subscriber.md: extend the worst-case-latency line — `× 1.5` is the poll backoff alone; in-flight handlers holding the `max_concurrent` limiter add back-pressure on top. - subscriber.md: document the retry-rate consequence of NACK_ON_ERROR + lease_ttl. A handler that always raises retries every `lease_ttl` seconds; default `lease_ttl=30` is also the poison-pill retry rate. Point at `RejectMessage` for permanent drop. - publisher.md: mirror the basic.md "past activation fires immediately" note so readers who only see the publisher table know about it.
The "Failure modes" bullet promised a `max_attempts` counter "planned for a future release" but there is no tracking issue and no scheduled work. Replace the speculation with the truthful current state: a buggy handler retries every `lease_ttl` seconds indefinitely; use `RejectMessage` to drop, or track attempts in your own state if you need a hard cap.
…t_no_pending Test name + assertions document the intent; the testing.py comments and the previous commit message capture the WHY (avoid lying via unstubbed AsyncMock). Removes the only ruff D205 issue.
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.
No description provided.