Remove long deprecated settings that moved from experimental to

ask_strategy
This commit is contained in:
Matthias
2020-11-27 20:24:04 +01:00
parent 22ff67c8f8
commit 95c3c45ec9
3 changed files with 70 additions and 13 deletions

View File

@@ -16,6 +16,7 @@ from freqtrade.configuration import (Configuration, check_exchange, remove_crede
from freqtrade.configuration.config_validation import validate_config_schema
from freqtrade.configuration.deprecated_settings import (check_conflicting_settings,
process_deprecated_setting,
process_removed_setting,
process_temporary_deprecated_settings)
from freqtrade.configuration.load_config import load_config_file, log_config_error_range
from freqtrade.constants import DEFAULT_DB_DRYRUN_URL, DEFAULT_DB_PROD_URL
@@ -1061,13 +1062,11 @@ def test_pairlist_resolving_fallback(mocker):
assert config['datadir'] == Path.cwd() / "user_data/data/binance"
@pytest.mark.skip(reason='Currently no deprecated / moved sections')
# The below is kept as a sample for the future.
@pytest.mark.parametrize("setting", [
("ask_strategy", "use_sell_signal", True,
"experimental", "use_sell_signal", False),
("ask_strategy", "sell_profit_only", False,
"experimental", "sell_profit_only", True),
("ask_strategy", "ignore_roi_if_buy_signal", False,
"experimental", "ignore_roi_if_buy_signal", True),
])
def test_process_temporary_deprecated_settings(mocker, default_conf, setting, caplog):
patched_configuration_load_config_file(mocker, default_conf)
@@ -1097,6 +1096,25 @@ def test_process_temporary_deprecated_settings(mocker, default_conf, setting, ca
assert default_conf[setting[0]][setting[1]] == setting[5]
@pytest.mark.parametrize("setting", [
("experimental", "use_sell_signal", False),
("experimental", "sell_profit_only", True),
("experimental", "ignore_roi_if_buy_signal", True),
])
def test_process_removed_settings(mocker, default_conf, setting, caplog):
patched_configuration_load_config_file(mocker, default_conf)
# Create sections for new and deprecated settings
# (they may not exist in the config)
default_conf[setting[0]] = {}
# Assign removed setting
default_conf[setting[0]][setting[1]] = setting[2]
# New and deprecated settings are conflicting ones
with pytest.raises(OperationalException,
match=r'Setting .* has been moved'):
process_temporary_deprecated_settings(default_conf)
def test_process_deprecated_setting_edge(mocker, edge_conf, caplog):
patched_configuration_load_config_file(mocker, edge_conf)
edge_conf.update({'edge': {
@@ -1196,6 +1214,30 @@ def test_process_deprecated_setting(mocker, default_conf, caplog):
assert default_conf['sectionA']['new_setting'] == 'valA'
def test_process_removed_setting(mocker, default_conf, caplog):
patched_configuration_load_config_file(mocker, default_conf)
# Create sections for new and deprecated settings
# (they may not exist in the config)
default_conf['sectionA'] = {}
default_conf['sectionB'] = {}
# Assign new setting
default_conf['sectionB']['somesetting'] = 'valA'
# Only new setting exists (nothing should happen)
process_removed_setting(default_conf,
'sectionA', 'somesetting',
'sectionB', 'somesetting')
# Assign removed setting
default_conf['sectionA']['somesetting'] = 'valB'
with pytest.raises(OperationalException,
match=r"Setting .* has been moved"):
process_removed_setting(default_conf,
'sectionA', 'somesetting',
'sectionB', 'somesetting')
def test_process_deprecated_ticker_interval(mocker, default_conf, caplog):
message = "DEPRECATED: Please use 'timeframe' instead of 'ticker_interval."
config = deepcopy(default_conf)