Fix remaining user_data leaks

This commit is contained in:
Matthias
2024-04-25 11:02:34 +02:00
parent ad12c98d10
commit 35408966f4
3 changed files with 12 additions and 5 deletions

View File

@@ -14,7 +14,8 @@ from tests.conftest import EXMS, get_args, log_has_re, patch_exchange
@pytest.fixture
def lookahead_conf(default_conf_usdt):
def lookahead_conf(default_conf_usdt, tmp_path):
default_conf_usdt['user_data_dir'] = tmp_path
default_conf_usdt['minimum_trade_amount'] = 10
default_conf_usdt['targeted_trade_amount'] = 20
default_conf_usdt['timerange'] = '20220101-20220501'

View File

@@ -1577,8 +1577,10 @@ def test_api_pair_candles(botclient, ohlcv_history):
])
def test_api_pair_history(botclient, mocker):
def test_api_pair_history(botclient, tmp_path, mocker):
_ftbot, client = botclient
_ftbot.config['user_data_dir'] = tmp_path
timeframe = '5m'
lfm = mocker.patch('freqtrade.strategy.interface.IStrategy.load_freqAI_model')
# No pair
@@ -1718,8 +1720,9 @@ def test_api_strategies(botclient, tmp_path):
]}
def test_api_strategy(botclient):
def test_api_strategy(botclient, tmp_path):
_ftbot, client = botclient
_ftbot.config['user_data_dir'] = tmp_path
rc = client_get(client, f"{BASE_URI}/strategy/{CURRENT_TEST_STRATEGY}")

View File

@@ -78,7 +78,9 @@ def test_load_strategy_base64(dataframe_1m, caplog, default_conf):
r".*(/|\\).*(/|\\)SampleStrategy\.py'\.\.\.", caplog)
def test_load_strategy_invalid_directory(caplog, default_conf):
def test_load_strategy_invalid_directory(caplog, default_conf, tmp_path):
default_conf['user_data_dir'] = tmp_path
extra_dir = Path.cwd() / 'some/path'
with pytest.raises(OperationalException, match=r"Impossible to load Strategy.*"):
StrategyResolver._load_strategy('StrategyTestV333', config=default_conf,
@@ -87,7 +89,8 @@ def test_load_strategy_invalid_directory(caplog, default_conf):
assert log_has_re(r'Path .*' + r'some.*path.*' + r'.* does not exist', caplog)
def test_load_not_found_strategy(default_conf):
def test_load_not_found_strategy(default_conf, tmp_path):
default_conf['user_data_dir'] = tmp_path
default_conf['strategy'] = 'NotFoundStrategy'
with pytest.raises(OperationalException,
match=r"Impossible to load Strategy 'NotFoundStrategy'. "