convert exportfilename to Path when config parsing
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
from arrow import Arrow
|
||||
from pandas import DataFrame, DateOffset, to_datetime, Timestamp
|
||||
from pandas import DataFrame, DateOffset, Timestamp, to_datetime
|
||||
|
||||
from freqtrade.configuration import TimeRange
|
||||
from freqtrade.data.btanalysis import (BT_DATA_COLUMNS,
|
||||
@@ -111,7 +112,7 @@ def test_load_trades(default_conf, mocker):
|
||||
|
||||
db_mock.reset_mock()
|
||||
bt_mock.reset_mock()
|
||||
default_conf['exportfilename'] = "testfile.json"
|
||||
default_conf['exportfilename'] = Path("testfile.json")
|
||||
load_trades("file",
|
||||
db_url=default_conf.get('db_url'),
|
||||
exportfilename=default_conf.get('exportfilename'),)
|
||||
|
@@ -224,6 +224,7 @@ def test_setup_bt_configuration_with_arguments(mocker, default_conf, caplog) ->
|
||||
assert 'export' in config
|
||||
assert log_has('Parameter --export detected: {} ...'.format(config['export']), caplog)
|
||||
assert 'exportfilename' in config
|
||||
assert isinstance(config['exportfilename'], Path)
|
||||
assert log_has('Storing backtest results to {} ...'.format(config['exportfilename']), caplog)
|
||||
|
||||
assert 'fee' in config
|
||||
|
@@ -49,7 +49,7 @@ def test_init_plotscript(default_conf, mocker, testdatadir):
|
||||
default_conf['trade_source'] = "file"
|
||||
default_conf['ticker_interval'] = "5m"
|
||||
default_conf["datadir"] = testdatadir
|
||||
default_conf['exportfilename'] = str(testdatadir / "backtest-result_test.json")
|
||||
default_conf['exportfilename'] = testdatadir / "backtest-result_test.json"
|
||||
ret = init_plotscript(default_conf)
|
||||
assert "ohlcv" in ret
|
||||
assert "trades" in ret
|
||||
@@ -318,7 +318,7 @@ def test_start_plot_dataframe(mocker):
|
||||
def test_load_and_plot_trades(default_conf, mocker, caplog, testdatadir):
|
||||
default_conf['trade_source'] = 'file'
|
||||
default_conf["datadir"] = testdatadir
|
||||
default_conf['exportfilename'] = str(testdatadir / "backtest-result_test.json")
|
||||
default_conf['exportfilename'] = testdatadir / "backtest-result_test.json"
|
||||
default_conf['indicators1'] = ["sma5", "ema10"]
|
||||
default_conf['indicators2'] = ["macd"]
|
||||
default_conf['pairs'] = ["ETH/BTC", "LTC/BTC"]
|
||||
@@ -374,7 +374,7 @@ def test_start_plot_profit_error(mocker):
|
||||
def test_plot_profit(default_conf, mocker, testdatadir, caplog):
|
||||
default_conf['trade_source'] = 'file'
|
||||
default_conf["datadir"] = testdatadir
|
||||
default_conf['exportfilename'] = str(testdatadir / "backtest-result_test.json")
|
||||
default_conf['exportfilename'] = testdatadir / "backtest-result_test.json"
|
||||
default_conf['pairs'] = ["ETH/BTC", "LTC/BTC"]
|
||||
|
||||
profit_mock = MagicMock()
|
||||
|
Reference in New Issue
Block a user