Opened 10 years ago
Closed 10 years ago
#22320 closed New feature (duplicate)
assertNumQueries should capture call stacks
Reported by: | Malcolm Box | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When an assertNumQueries assertion fails there are two things that are very helpful in diagnosing the issue: the SQL calls generated, and what caused them. assertNumQueries does a good job with the former, but provides no help with the latter.
If the CursorDebugWrapper kept track of the traceback for each query, it would be simple to see what had caused any unexpected queries.
Change History (3)
comment:1 Changed 10 years ago by
Has patch: | set |
---|
comment:2 Changed 10 years ago by
Version: | 1.6 → master |
---|
Note: See
TracTickets for help on using
tickets.
Patch available here: https://github.com/mbox/django/commit/c0a5fa22770b90d3ad0fd24ee80b93bebe03fbec