On Thu, 2008-09-18 at 14:00 -0700, meppum wrote:
> I wanted to see some of the queries that get generated by the django
> orm during unit testing. I figured the below example would work but
> connection.queries in empty. Anyone have any hints as to why and if
> there is a work around? Thanks.
> 
> def testSQLOutput(self):
>         from django.db import connection
>         states = State.objects.all()
>         print len(states)
>         print connection.queries
> 

By default DEBUG=False in tests, which means connection.queries won't
contain anything. There are a number of tests under the tests/ directory
in Django itself that temporarily set DEBUG=True and use
connection.queries. That's always a good place to look for pointers.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to