Code

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#8401 closed (fixed)

Document : 'django.test.simple.run_tests' - forces settings.DEBUG = False

Reported by: rishi Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: TEST_RUNNER DEBUG test
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

There doesn't seem to be a documented reason for forcing the settings.DEBUG value to False. The TEST_RUNNER should just use the value specified in the --settings option of the test management command. If there is a good reason to force the setting, it should be doc'd.

Commenting out this line and running this test w/ settings.DEBUG = True seems to work.

Here is the code:
source:/django/trunk/django/test/simple.py#L123

Attachments (0)

Change History (5)

comment:1 Changed 6 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

There are at least 2 very good reasons for forcing settings DEBUG=False during tests. One is philosophical - your live site should be running with Debug=False, and test conditions should be matching your live site. The second reason is practial - there are some aspects of Django (most notably the handling of errors in templates, but there are others) which can have an effect on the output of tests.

If this isn't documented in the user docs, it should be. Documentation changes are momentarily on hold until the documentation refactor lands in a couple of days, but I'll look into this more when the refactor lands.

comment:2 Changed 6 years ago by ericholscher

  • Component changed from Unit test system to Documentation
  • milestone set to 1.0
  • Summary changed from Default TEST_RUNNER - 'django.test.simple.run_tests' - forces settings.DEBUG = False to Document : 'django.test.simple.run_tests' - forces settings.DEBUG = False
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 6 years ago by mtredinnick

  • milestone changed from 1.0 to post-1.0

comment:4 Changed 6 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [8514]) Fixed #8401: Added a note on the fact that DEBUG=False is forced during test execution. Thanks to rishi for the suggestion.

comment:5 Changed 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.