parent
1b9cbef198
commit
eabc3b6c8d
|
@ -97,4 +97,7 @@ def file_storage_changed(**kwargs):
|
|||
@receiver(setting_changed)
|
||||
def complex_setting_changed(**kwargs):
|
||||
if kwargs['enter'] and kwargs['setting'] in COMPLEX_OVERRIDE_SETTINGS:
|
||||
warnings.warn("Overriding setting %s can lead to unexpected behaviour." % kwargs['setting'])
|
||||
# Considering the current implementation of the signals framework,
|
||||
# stacklevel=5 shows the line containing the override_settings call.
|
||||
warnings.warn("Overriding setting %s can lead to unexpected behaviour."
|
||||
% kwargs['setting'], stacklevel=5)
|
||||
|
|
|
@ -227,13 +227,13 @@ class TestComplexSettingOverride(TestCase):
|
|||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter("always")
|
||||
|
||||
override = override_settings(TEST_WARN='override')
|
||||
override.enable()
|
||||
self.assertEqual('override', settings.TEST_WARN)
|
||||
override.disable()
|
||||
with override_settings(TEST_WARN='override'):
|
||||
self.assertEqual(settings.TEST_WARN, 'override')
|
||||
|
||||
self.assertEqual(len(w), 1)
|
||||
self.assertEqual('Overriding setting TEST_WARN can lead to unexpected behaviour.', str(w[-1].message))
|
||||
self.assertEqual(w[0].filename, __file__)
|
||||
self.assertEqual(str(w[0].message),
|
||||
'Overriding setting TEST_WARN can lead to unexpected behaviour.')
|
||||
|
||||
|
||||
class UniqueSettingsTests(TestCase):
|
||||
|
|
Loading…
Reference in New Issue