reuse mock in hyperopt also

This commit is contained in:
Janne Sinivirta 2017-10-30 22:31:28 +02:00
parent 7190226c84
commit e68e6c0a1a
1 changed files with 3 additions and 2 deletions

View File

@ -79,9 +79,10 @@ def buy_strategy_generator(params):
@pytest.mark.skipif(not os.environ.get('BACKTEST', False), reason="BACKTEST not set")
def test_hyperopt(conf, pairs, mocker):
mocked_buy_trend = mocker.patch('freqtrade.analyze.populate_buy_trend')
def optimizer(params):
buy_strategy = buy_strategy_generator(params)
mocker.patch('freqtrade.analyze.populate_buy_trend', side_effect=buy_strategy)
mocked_buy_trend.side_effect = buy_strategy_generator(params)
results = backtest(conf, pairs, mocker)
result = format_results(results)