Currently, when assertNumQueries fails, the output is perhaps less helpful than it might be:
Traceback (most recent call last):
File "/home/dom/.virtualenvs/kanisa/src/kanisa/kanisa/tests/views/public.py", line 31, in test_kanisa_root_view
File "/home/dom/.virtualenvs/kanisa/src/kanisa/.tox/py27-1.5.X/local/lib/python2.7/site-packages/django/test/testcases.py", line 195, in __exit__
AssertionError: 5 queries executed, 99 expected
When an assertNumQueries check fails, the first thing I (and I'd guess everyone else too) want to know is what queries ran, so it'd be awesome if an assertNumQueries failure printed the list of queries. Charlie Denton has a blog post describing how he does this (
http://meshy.co.uk/posts/debugging-assertnumqueries-tests/), but I'd like to see this included in Django itself - since it seems generally helpful.
I'm very happy to work on this and provide a patch (and a ticket), I just wanted to solicit some feedback before I did too much work on it, in case I'm missing a reason why this hasn't already been done (I appreciate this can be done outside of Django, but I think its of sufficiently general utility to warrant being in core).
Dom