Skip to content

Commit

Permalink
Fix remaining user_data leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Apr 25, 2024
1 parent ad12c98 commit 3540896
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion tests/optimize/test_lookahead_analysis.py
Expand Up @@ -14,7 +14,8 @@


@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'
Expand Down
7 changes: 5 additions & 2 deletions tests/rpc/test_rpc_apiserver.py
Expand Up @@ -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
Expand Down Expand Up @@ -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}")

Expand Down
7 changes: 5 additions & 2 deletions tests/strategy/test_strategy_loading.py
Expand Up @@ -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,
Expand All @@ -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'. "
Expand Down

0 comments on commit 3540896

Please sign in to comment.