add fixes for random test failures

This commit is contained in:
Matthias 2022-09-26 08:11:00 +00:00
parent 041258a549
commit a1a62681bf
3 changed files with 9 additions and 8 deletions

View File

@ -61,7 +61,7 @@ class Hyperopt:
""" """
Hyperopt class, this class contains all the logic to run a hyperopt simulation Hyperopt class, this class contains all the logic to run a hyperopt simulation
To run a backtest: To start a hyperopt run:
hyperopt = Hyperopt(config) hyperopt = Hyperopt(config)
hyperopt.start() hyperopt.start()
""" """

View File

@ -6,6 +6,7 @@ import pandas as pd
import pytest import pytest
from freqtrade.enums import ExitType, RunMode from freqtrade.enums import ExitType, RunMode
from freqtrade.optimize.backtesting import Backtesting
from freqtrade.optimize.hyperopt import Hyperopt from freqtrade.optimize.hyperopt import Hyperopt
from tests.conftest import patch_exchange from tests.conftest import patch_exchange
@ -28,6 +29,13 @@ def hyperopt_conf(default_conf):
return hyperconf return hyperconf
@pytest.fixture(autouse=True)
def backtesting_cleanup() -> None:
yield None
Backtesting.cleanup()
@pytest.fixture(scope='function') @pytest.fixture(scope='function')
def hyperopt(hyperopt_conf, mocker): def hyperopt(hyperopt_conf, mocker):

View File

@ -52,13 +52,6 @@ def trim_dictlist(dict_list, num):
return new return new
@pytest.fixture(autouse=True)
def backtesting_cleanup() -> None:
yield None
Backtesting.cleanup()
def load_data_test(what, testdatadir): def load_data_test(what, testdatadir):
timerange = TimeRange.parse_timerange('1510694220-1510700340') timerange = TimeRange.parse_timerange('1510694220-1510700340')
data = history.load_pair_history(pair='UNITTEST/BTC', datadir=testdatadir, data = history.load_pair_history(pair='UNITTEST/BTC', datadir=testdatadir,