Skip to content

Commit

Permalink
Fixed #17787 -- Documented reset caches by setting_changed signal
Browse files Browse the repository at this point in the history
  • Loading branch information
claudep committed Oct 27, 2012
1 parent b7d8171 commit fc2681b
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions docs/topics/testing.txt
Expand Up @@ -1586,15 +1586,23 @@ The decorator can also be applied to test case classes::
the original ``LoginTestCase`` is still equally affected by the the original ``LoginTestCase`` is still equally affected by the
decorator. decorator.


.. note:: When overriding settings, make sure to handle the cases in which your app's

code uses a cache or similar feature that retains state even if the
When overriding settings, make sure to handle the cases in which your app's setting is changed. Django provides the
code uses a cache or similar feature that retains state even if the :data:`django.test.signals.setting_changed` signal that lets you register
setting is changed. Django provides the callbacks to clean up and otherwise reset state when settings are changed.
:data:`django.test.signals.setting_changed` signal that lets you register
callbacks to clean up and otherwise reset state when settings are changed. Django itself uses this signal to reset various data:
Note that this signal isn't currently used by Django itself, so changing
built-in settings may not yield the results you expect. =========================== ========================
Overriden settings Data reset
=========================== ========================
USE_TZ, TIME_ZONE Databases timezone
TEMPLATE_CONTEXT_PROCESSORS Context processors cache
TEMPLATE_LOADERS Template loaders cache
SERIALIZATION_MODULES Serializers cache
LOCALE_PATHS, LANGUAGE_CODE Default translation and loaded translations
=========================== ========================


Emptying the test outbox Emptying the test outbox
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit fc2681b

Please sign in to comment.