deprecated-setting moval should delete old setting
This commit is contained in:
parent
5d4386f037
commit
420cc5c595
@ -64,6 +64,7 @@ def process_deprecated_setting(config: Dict[str, Any],
|
||||
|
||||
section_new_config = config.get(section_new, {}) if section_new else config
|
||||
section_new_config[name_new] = section_old_config[name_old]
|
||||
del section_old_config[name_old]
|
||||
|
||||
|
||||
def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
|
||||
|
@ -1280,11 +1280,14 @@ def test_process_deprecated_setting(mocker, default_conf, caplog):
|
||||
# The value of the new setting shall have been set to the
|
||||
# value of the deprecated one
|
||||
assert default_conf['sectionA']['new_setting'] == 'valB'
|
||||
# Old setting is removed
|
||||
assert 'deprecated_setting' not in default_conf['sectionB']
|
||||
|
||||
caplog.clear()
|
||||
|
||||
# Delete new setting (deprecated exists)
|
||||
del default_conf['sectionA']['new_setting']
|
||||
default_conf['sectionB']['deprecated_setting'] = 'valB'
|
||||
process_deprecated_setting(default_conf,
|
||||
'sectionB', 'deprecated_setting',
|
||||
'sectionA', 'new_setting')
|
||||
@ -1298,7 +1301,7 @@ def test_process_deprecated_setting(mocker, default_conf, caplog):
|
||||
# Assign new setting
|
||||
default_conf['sectionA']['new_setting'] = 'valA'
|
||||
# Delete deprecated setting
|
||||
del default_conf['sectionB']['deprecated_setting']
|
||||
default_conf['sectionB'].pop('deprecated_setting', None)
|
||||
process_deprecated_setting(default_conf,
|
||||
'sectionB', 'deprecated_setting',
|
||||
'sectionA', 'new_setting')
|
||||
|
Loading…
Reference in New Issue
Block a user