reuse mock in hyperopt also
This commit is contained in:
parent
7190226c84
commit
e68e6c0a1a
@ -79,9 +79,10 @@ def buy_strategy_generator(params):
|
|||||||
|
|
||||||
@pytest.mark.skipif(not os.environ.get('BACKTEST', False), reason="BACKTEST not set")
|
@pytest.mark.skipif(not os.environ.get('BACKTEST', False), reason="BACKTEST not set")
|
||||||
def test_hyperopt(conf, pairs, mocker):
|
def test_hyperopt(conf, pairs, mocker):
|
||||||
|
mocked_buy_trend = mocker.patch('freqtrade.analyze.populate_buy_trend')
|
||||||
def optimizer(params):
|
def optimizer(params):
|
||||||
buy_strategy = buy_strategy_generator(params)
|
mocked_buy_trend.side_effect = buy_strategy_generator(params)
|
||||||
mocker.patch('freqtrade.analyze.populate_buy_trend', side_effect=buy_strategy)
|
|
||||||
results = backtest(conf, pairs, mocker)
|
results = backtest(conf, pairs, mocker)
|
||||||
|
|
||||||
result = format_results(results)
|
result = format_results(results)
|
||||||
|
Loading…
Reference in New Issue
Block a user