#27008: allow DEBUG to be enabled when running tests
-----------------------------------+--------------------------------------
     Reporter:  cjerdonek          |                    Owner:  nobody
         Type:  New feature        |                   Status:  new
    Component:  Testing framework  |                  Version:  1.10
     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 cjerdonek):

 One use case is the following. Say you have some views that return JSON.
 And say they're set up so that if `DEBUG` is enabled and there is a
 server-side error, the JSON includes detailed exception info (analogous to
 the HTML debug view). Otherwise, only a failure status code is returned.
 And further say you have tests that involve calling these views and
 checking the response.

 If there is a server-side error when calling these views during a test,
 the absence of any exception info can make the test hard to troubleshoot.
 I found that having to edit the code manually each time there was such an
 error to change the settings for that test was unnecessarily time-
 consuming.

 Another use case is if your code includes additional asserts when running
 in `DEBUG` mode.

 Regarding an expectation that tests pass in `DEBUG`, I think you could
 simply document that it not be necessary. Or perhaps only allow the
 `--debug` option when test labels are also passed to the command (i.e.
 disallow the option when running all tests). In my experience, I've only
 had a need to use it when troubleshooting individual tests.

--
Ticket URL: <https://code.djangoproject.com/ticket/27008#comment:2>
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/067.9f4f502e36fe5fb8baaab109c2d5cc7d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to