#19167: When running tests, Django accesses the database referred to in settings
-------------------------------+--------------------------------------
     Reporter:  EvilDMP        |                    Owner:  nobody
         Type:  Uncategorized  |                   Status:  new
    Component:  Uncategorized  |                  Version:  1.4
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------

Comment (by akaariai):

 I am not sure if this is documented or not. If not a docs note would be
 welcome (likely recommending something like what was done in comment:5).

 I am pretty sure we could prevent this in tests using the idea in
 comment:3. Assuming users actually write tests, then import time queries
 would be spotted...

 Another option is to have prevent_normal_queries() and
 enable_normal_queries() available. These could be called in various
 places, for example app-loading, test setup, syncdb etc. Then we would
 still need some way to bypass this prevention. If prevent_normal_queries
 just appends `__hidden__` to each alias in connections, then we could
 still run queries by `.using('__hidden__' + alias)` when needed.

 I am not at all sure this is worth all the trouble... And, I am pretty
 sure some user code would break.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19167#comment:6>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to