AssertNumQueries is often a problem for 3rd party backends. AssertMaxQueries would become the same and likely result in poorly written tests because of the inherent slop factor in the arbitrarily chosen max value.
I'm not opposed to Django adding this. I'm opposed to Django using it in its own test suite. Regards, Michael Manfre On Sun, Aug 17, 2014 at 2:52 AM, Roger Hunwicks <[email protected]> wrote: > 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 [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/4d8d120a-8819-4a7d-977f-4acae670130f%40googlegroups.com > <https://groups.google.com/d/msgid/django-developers/4d8d120a-8819-4a7d-977f-4acae670130f%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAGdCwBsH1BT%2BO%2Bta5A5%2BSTMN0VV7Kum0Am5Lk0BkGJa5JQKTkA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
