Opened 8 years ago

Closed 8 years ago

Last modified 8 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:


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:

Change History (5)

comment:1 Changed 8 years ago by Russell Keith-Magee

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 8 years ago by Eric Holscher

Component: Unit test systemDocumentation
milestone: 1.0
Summary: Default TEST_RUNNER - 'django.test.simple.run_tests' - forces settings.DEBUG = FalseDocument : 'django.test.simple.run_tests' - forces settings.DEBUG = False
Triage Stage: UnreviewedAccepted

comment:3 Changed 8 years ago by Malcolm Tredinnick

milestone: 1.0post-1.0

comment:4 Changed 8 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(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 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top