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
[banner1.pk, banner2.pk, banner3.pk, banner5.pk, ])
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__
executed, self.num
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
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/20327acd-1354-49dc-a5e0-16c4e7e6ee99%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.