#23746: Allow assertNumQueries to clear caches before it runs
-----------------------------------+------------------------------------
     Reporter:  wrwrwr             |                    Owner:  nobody
         Type:  New feature        |                   Status:  new
    Component:  Testing framework  |                  Version:  master
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Accepted
    Has patch:  1                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+------------------------------------
Changes (by wrwrwr):

 * needs_better_patch:  1 => 0


Comment:

 A somewhat [https://github.com/wrwrwr/django/compare/ticket_23746?expand=1
 different solution], with the same effect:
 * added a new `pre_capture_queries` signal sent when entering the
 `CaptureQueriesContext` (also for the base manager not only
 `assertNumQueries`);
 * dropped the `clear_caches` toggle as in the new context it seemed to
 general (which caches?); if you really want to miss some queries,
 selectively disconnecting their respective receivers is a less convenient,
 but more fine-grained option.

 There are some other possibilities to consider: -- a more general non-
 testing-only `clear_caches` signal, -- some `register` function on the
 test runner, or just bringing back the toggle for convenience.

--
Ticket URL: <https://code.djangoproject.com/ticket/23746#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.211447323a09556ad3b5fcb9c817c15d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to