assertNumQueries should capture call stacks
|Reported by:||Malcolm Box||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.