--
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-develop...@googlegroups.com.
To post to this group, send email to django-d...@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.
I use this method on my own test subclasses, and I find it useful as a tripwire: a cause for review and consideration, more than a hard error. Did the number of queries go up on this change? Is that reasonable or a mistake? Have we blown the perf budget so we should refactor? Or maybe the number should just be raised to something that seems like a reasonable next tripwire.
These limits aren't flaky or false positives, so they seem useful supports given a reasonable test suite otherwise.
--
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-develop...@googlegroups.com.
To post to this group, send email to django-d...@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/41676693-480d-4dfc-82a6-377da0f54057%40googlegroups.com.
Not sure about the feasibility, though; would you be willing to work up a rough implementation of it?
self.test_case.assertLessEqual(
executed, self.num, "%d queries executed, %d or less expected" % (
executed, self.num
)
max_queries = {'admin:app1_model1_change': 50,
'admin:app1_model2_add': 100,
'admin:app2_model1_changelist': 100}
<snip>
for model in get_models():
if model in admin.site._registry:
try:
if admin.site._registry[model].has_add_permission(type("request", (), {"user": user})):
route = "admin:%s_%s_add" % (model._meta.app_label, model._meta.module_name)
url = reverse(route)
with self.assertMaxQueries(max_queries.get(route, 10)):
response = self.client.get(url, follow=True)