mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
Auto-mock user_dir to tmpdir
This will avoid depending on the user directory being present for tests
This commit is contained in:
@@ -411,6 +411,12 @@ def patch_gc(mocker) -> None:
|
||||
mocker.patch("freqtrade.main.gc_set_threshold")
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def patched_user_dir(mocker, tmpdir) -> None:
|
||||
mocker.patch('freqtrade.configuration.configuration.create_userdata_dir',
|
||||
return_value=Path(tmpdir) / "user_data")
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def patch_coingekko(mocker) -> None:
|
||||
"""
|
||||
|
||||
@@ -1271,7 +1271,7 @@ def test_pairlist_resolving_with_config_pl_not_exists(mocker, default_conf):
|
||||
configuration.get_config()
|
||||
|
||||
|
||||
def test_pairlist_resolving_fallback(mocker):
|
||||
def test_pairlist_resolving_fallback(mocker, tmpdir):
|
||||
mocker.patch.object(Path, "exists", MagicMock(return_value=True))
|
||||
mocker.patch.object(Path, "open", MagicMock(return_value=MagicMock()))
|
||||
mocker.patch("freqtrade.configuration.configuration.load_file",
|
||||
@@ -1290,7 +1290,7 @@ def test_pairlist_resolving_fallback(mocker):
|
||||
|
||||
assert config['pairs'] == ['ETH/BTC', 'XRP/BTC']
|
||||
assert config['exchange']['name'] == 'binance'
|
||||
assert config['datadir'] == Path.cwd() / "user_data/data/binance"
|
||||
assert config['datadir'] == Path(tmpdir) / "user_data/data/binance"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("setting", [
|
||||
|
||||
Reference in New Issue
Block a user