diff options
| author | Tom Christie | 2015-01-27 13:51:30 +0000 |
|---|---|---|
| committer | Tom Christie | 2015-01-27 13:51:30 +0000 |
| commit | 65bca59ea548dc5e2222be06ca20b3d3fa151cf0 (patch) | |
| tree | 2ed863b4a90daf7839c55ee0db02eb78190d72be /tests/utils.py | |
| parent | fc70c0862ff3e6183b79adc4675a63874261ddf0 (diff) | |
| download | django-rest-framework-65bca59ea548dc5e2222be06ca20b3d3fa151cf0.tar.bz2 | |
Reload api_settings when using Django's 'override_settings'
Diffstat (limited to 'tests/utils.py')
| -rw-r--r-- | tests/utils.py | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/tests/utils.py b/tests/utils.py index 5e902ba9..5b2d7586 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,30 +1,5 @@ -from contextlib import contextmanager from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import NoReverseMatch -from django.utils import six -from rest_framework.settings import api_settings - - -@contextmanager -def temporary_setting(setting, value, module=None): - """ - Temporarily change value of setting for test. - - Optionally reload given module, useful when module uses value of setting on - import. - """ - original_value = getattr(api_settings, setting) - setattr(api_settings, setting, value) - - if module is not None: - six.moves.reload_module(module) - - yield - - setattr(api_settings, setting, original_value) - - if module is not None: - six.moves.reload_module(module) class MockObject(object): |
