Create datadir when not exists
This commit is contained in:
@@ -202,10 +202,11 @@ def test_setup_configuration_without_arguments(mocker, default_conf, caplog) ->
|
||||
assert 'export' not in config
|
||||
|
||||
|
||||
def test_setup_configuration_with_arguments(mocker, default_conf, caplog) -> None:
|
||||
def test_setup_bt_configuration_with_arguments(mocker, default_conf, caplog) -> None:
|
||||
mocker.patch('freqtrade.configuration.open', mocker.mock_open(
|
||||
read_data=json.dumps(default_conf)
|
||||
))
|
||||
mocker.patch('freqtrade.configuration.Configuration._create_datadir', lambda s, c, x: x)
|
||||
|
||||
args = [
|
||||
'--config', 'config.json',
|
||||
|
@@ -46,10 +46,11 @@ def test_setup_configuration_without_arguments(mocker, default_conf, caplog) ->
|
||||
assert 'stoploss_range' not in config
|
||||
|
||||
|
||||
def test_setup_configuration_with_arguments(mocker, edge_conf, caplog) -> None:
|
||||
def test_setup_edge_configuration_with_arguments(mocker, edge_conf, caplog) -> None:
|
||||
mocker.patch('freqtrade.configuration.open', mocker.mock_open(
|
||||
read_data=json.dumps(edge_conf)
|
||||
))
|
||||
mocker.patch('freqtrade.configuration.Configuration._create_datadir', lambda s, c, x: x)
|
||||
|
||||
args = [
|
||||
'--config', 'config.json',
|
||||
|
@@ -247,6 +247,7 @@ def test_setup_configuration_with_arguments(mocker, default_conf, caplog) -> Non
|
||||
mocker.patch('freqtrade.configuration.open', mocker.mock_open(
|
||||
read_data=json.dumps(default_conf)
|
||||
))
|
||||
mocker.patch('freqtrade.configuration.Configuration._create_datadir', lambda s, c, x: x)
|
||||
|
||||
arglist = [
|
||||
'--config', 'config.json',
|
||||
@@ -487,3 +488,13 @@ def test_load_config_warn_forcebuy(default_conf, mocker, caplog) -> None:
|
||||
|
||||
def test_validate_default_conf(default_conf) -> None:
|
||||
validate(default_conf, constants.CONF_SCHEMA, Draft4Validator)
|
||||
|
||||
|
||||
def test__create_datadir(mocker, default_conf, caplog) -> None:
|
||||
mocker.patch('os.path.isdir', MagicMock(return_value=False))
|
||||
md = MagicMock()
|
||||
mocker.patch('os.makedirs', md)
|
||||
cfg = Configuration(Namespace())
|
||||
cfg._create_datadir(default_conf, '/foo/bar')
|
||||
assert md.call_args[0][0] == "/foo/bar"
|
||||
assert log_has('Created data directory: /foo/bar', caplog.record_tuples)
|
||||
|
Reference in New Issue
Block a user