I'm doing some refactoring of a Django app and I want to make sure that I 
don't introduce any really poorly performing pages as a result of poor 
queries.

I want to write a test that tries every registered URL and makes sure that 
none of them has an excessive number of queries.

AssertNumQueries doesn't seem very helpful to me, because it requires you 
to know when you write the test exactly how many queries the function 
should require.

I'd like to create an AssertMaxQueries that passes as long as the number of 
queries is less than or equal to the parameter provided to the context 
manager. You could also do this my adding a parameter to AssertNumQueries 
to tell it whether to test for equality or "less than or equal to": that 
would involve less duplicated code in testcases.py, but is possibly less 
discoverable for a test author.

Would that be a useful contribution to Django proper, or should I just 
create it in my own tests/utils.py.

Roger

-- 
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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/4d8d120a-8819-4a7d-977f-4acae670130f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to