feat(doubles): dump the recorded calls when a spy assertion fails - #905
Merged
Conversation
A failed call assertion showed only the one call it compared against, so diagnosing it meant guessing between "called with other arguments", "called in another order" and "called more times than expected" — a full edit-run-read cycle per guess, when the answer was already on disk in the spy's params file. Print that log under the failure, capped at 10 entries with an explicit "and N more" so a spy on a hot command cannot flood the report. The renderer reads the file with a `while read` loop on the failure path only, so the per-test fork budget is untouched, and the block goes through print_line like the rest of the failure so --simple output stays a single marker. `assert_have_been_called_with_args` renders the per-argument form, keeping the boundaries visible in the dump too. Closes #896
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.
🤔 Background
Related #896
A failed call assertion printed only the single call it happened to compare against. Working out whether the command was called with other arguments, in another order, or more times than expected took one edit-run-read cycle per guess — while the full call log was already recorded on disk.
💡 Changes
… and N more; nothing extra is printed when the assertion passes.while readloop, so the per-test fork budget is unaffected; the block is rendered throughprint_line, so--simplestays a single marker.assert_have_been_called_with_argsdumps the per-argument form, keeping boundaries visible.