There is a SimpleTestCase.settings method added in commit 0dc6420ⁱ, which, according to the docstring, returns “A context manager that temporarily sets a setting and reverts back to the original value when exiting the context.”. In commit a3a53e0² its implementation has been simplified so that now it is only an identity wrapper around override_settings class (which was added in the same commit). The documentation states that SimpleTestCase.settings should be used as a context manager and override_settings should be used as a decorator³, but, given that implementation, override_settings can be used for both tasks. Making a distinction generates only unnecessary noise, so I propose to deprecate and remove SimpleTestCase.settings method and document the fact that override_settings can act also as a context manager.

There is also a SimpleTestCase.urls class attribute which allows user to specify overriden ROOT_URLCONF setting. It was added in commit 415bd69⁴, long before SimpleTestCase.settings and override_settings were available. Currently the same effect can be achieved with override_settings decorator, so SimpleTestCase.urls can be considered redundant, and also marked for deprecation.

Krzysztof

ⁱ https://github.com/django/django/commit/0dc6420
² https://github.com/django/django/commit/a3a53e0
³ https://docs.djangoproject.com/en/dev/topics/testing/overview/#overriding-settings
https://github.com/django/django/commit/415bd69

--
You received this message because you are subscribed to the Google Groups "Django 
developers" 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].
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to