From df1c0540abffd71269a13c0dc4cea925f1b95597 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 26 Aug 2021 07:18:26 +0200 Subject: [PATCH] Rename Hyperopt Test Class --- tests/commands/test_commands.py | 4 ++-- tests/optimize/conftest.py | 2 +- ..._hyperopt.py => hyperopt_test_sep_file.py} | 2 +- tests/optimize/test_hyperopt.py | 20 +++++++++---------- 4 files changed, 14 insertions(+), 14 deletions(-) rename tests/optimize/hyperopts/{default_hyperopt.py => hyperopt_test_sep_file.py} (99%) diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index 9f21e93d7..5a177267c 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -839,7 +839,7 @@ def test_start_list_hyperopts(mocker, caplog, capsys): captured = capsys.readouterr() assert "TestHyperoptLegacy" not in captured.out assert "legacy_hyperopt.py" not in captured.out - assert "DefaultHyperOpt" in captured.out + assert "HyperoptTestSepFile" in captured.out assert "test_hyperopt.py" not in captured.out # Test regular output @@ -854,7 +854,7 @@ def test_start_list_hyperopts(mocker, caplog, capsys): captured = capsys.readouterr() assert "TestHyperoptLegacy" not in captured.out assert "legacy_hyperopt.py" not in captured.out - assert "DefaultHyperOpt" in captured.out + assert "HyperoptTestSepFile" in captured.out def test_start_test_pairlist(mocker, caplog, tickers, default_conf, capsys): diff --git a/tests/optimize/conftest.py b/tests/optimize/conftest.py index a7fd238d1..95c9fef97 100644 --- a/tests/optimize/conftest.py +++ b/tests/optimize/conftest.py @@ -16,7 +16,7 @@ def hyperopt_conf(default_conf): hyperconf.update({ 'datadir': Path(default_conf['datadir']), 'runmode': RunMode.HYPEROPT, - 'hyperopt': 'DefaultHyperOpt', + 'hyperopt': 'HyperoptTestSepFile', 'hyperopt_loss': 'ShortTradeDurHyperOptLoss', 'hyperopt_path': str(Path(__file__).parent / 'hyperopts'), 'epochs': 1, diff --git a/tests/optimize/hyperopts/default_hyperopt.py b/tests/optimize/hyperopts/hyperopt_test_sep_file.py similarity index 99% rename from tests/optimize/hyperopts/default_hyperopt.py rename to tests/optimize/hyperopts/hyperopt_test_sep_file.py index 2e2bca3d0..0fa1e1959 100644 --- a/tests/optimize/hyperopts/default_hyperopt.py +++ b/tests/optimize/hyperopts/hyperopt_test_sep_file.py @@ -11,7 +11,7 @@ import freqtrade.vendor.qtpylib.indicators as qtpylib from freqtrade.optimize.hyperopt_interface import IHyperOpt -class DefaultHyperOpt(IHyperOpt): +class HyperoptTestSepFile(IHyperOpt): """ Default hyperopt provided by the Freqtrade bot. You can override it with your own Hyperopt diff --git a/tests/optimize/test_hyperopt.py b/tests/optimize/test_hyperopt.py index 0ca79d268..94f4abc7a 100644 --- a/tests/optimize/test_hyperopt.py +++ b/tests/optimize/test_hyperopt.py @@ -22,7 +22,7 @@ from freqtrade.strategy.hyper import IntParameter from tests.conftest import (get_args, log_has, log_has_re, patch_exchange, patched_configuration_load_config_file) -from .hyperopts.default_hyperopt import DefaultHyperOpt +from .hyperopts.hyperopt_test_sep_file import HyperoptTestSepFile def test_setup_hyperopt_configuration_without_arguments(mocker, default_conf, caplog) -> None: @@ -31,7 +31,7 @@ def test_setup_hyperopt_configuration_without_arguments(mocker, default_conf, ca args = [ 'hyperopt', '--config', 'config.json', - '--hyperopt', 'DefaultHyperOpt', + '--hyperopt', 'HyperoptTestSepFile', ] config = setup_optimize_configuration(get_args(args), RunMode.HYPEROPT) @@ -63,7 +63,7 @@ def test_setup_hyperopt_configuration_with_arguments(mocker, default_conf, caplo args = [ 'hyperopt', '--config', 'config.json', - '--hyperopt', 'DefaultHyperOpt', + '--hyperopt', 'HyperoptTestSepFile', '--datadir', '/foo/bar', '--timeframe', '1m', '--timerange', ':100', @@ -115,7 +115,7 @@ def test_setup_hyperopt_configuration_stake_amount(mocker, default_conf) -> None args = [ 'hyperopt', '--config', 'config.json', - '--hyperopt', 'DefaultHyperOpt', + '--hyperopt', 'HyperoptTestSepFile', '--stake-amount', '1', '--starting-balance', '2' ] @@ -136,7 +136,7 @@ def test_setup_hyperopt_configuration_stake_amount(mocker, default_conf) -> None def test_hyperoptresolver(mocker, default_conf, caplog) -> None: patched_configuration_load_config_file(mocker, default_conf) - hyperopt = DefaultHyperOpt + hyperopt = HyperoptTestSepFile delattr(hyperopt, 'populate_indicators') delattr(hyperopt, 'populate_buy_trend') delattr(hyperopt, 'populate_sell_trend') @@ -144,7 +144,7 @@ def test_hyperoptresolver(mocker, default_conf, caplog) -> None: 'freqtrade.resolvers.hyperopt_resolver.HyperOptResolver.load_object', MagicMock(return_value=hyperopt(default_conf)) ) - default_conf.update({'hyperopt': 'DefaultHyperOpt'}) + default_conf.update({'hyperopt': 'HyperoptTestSepFile'}) x = HyperOptResolver.load_hyperopt(default_conf) assert not hasattr(x, 'populate_indicators') assert not hasattr(x, 'populate_buy_trend') @@ -184,7 +184,7 @@ def test_start_not_installed(mocker, default_conf, import_fails) -> None: args = [ 'hyperopt', '--config', 'config.json', - '--hyperopt', 'DefaultHyperOpt', + '--hyperopt', 'HyperoptTestSepFile', '--hyperopt-path', str(Path(__file__).parent / "hyperopts"), '--epochs', '5', @@ -205,7 +205,7 @@ def test_start(mocker, hyperopt_conf, caplog) -> None: args = [ 'hyperopt', '--config', 'config.json', - '--hyperopt', 'DefaultHyperOpt', + '--hyperopt', 'HyperoptTestSepFile', '--hyperopt-loss', 'SharpeHyperOptLossDaily', '--epochs', '5' ] @@ -229,7 +229,7 @@ def test_start_no_data(mocker, hyperopt_conf) -> None: args = [ 'hyperopt', '--config', 'config.json', - '--hyperopt', 'DefaultHyperOpt', + '--hyperopt', 'HyperoptTestSepFile', '--hyperopt-loss', 'SharpeHyperOptLossDaily', '--epochs', '5' ] @@ -247,7 +247,7 @@ def test_start_filelock(mocker, hyperopt_conf, caplog) -> None: args = [ 'hyperopt', '--config', 'config.json', - '--hyperopt', 'DefaultHyperOpt', + '--hyperopt', 'HyperoptTestSepFile', '--hyperopt-loss', 'SharpeHyperOptLossDaily', '--epochs', '5' ]