mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Add test for load_config
This commit is contained in:
parent
06b59551b0
commit
2d7ccaeb3d
|
@ -43,7 +43,7 @@ def load_file(path: Path) -> Dict[str, Any]:
|
|||
with path.open('r') as file:
|
||||
config = rapidjson.load(file, parse_mode=CONFIG_PARSE_MODE)
|
||||
except FileNotFoundError:
|
||||
raise OperationalException(f'File file "{path}" not found!')
|
||||
raise OperationalException(f'File "{path}" not found!')
|
||||
return config
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ from freqtrade.configuration.deprecated_settings import (check_conflicting_setti
|
|||
process_deprecated_setting,
|
||||
process_removed_setting,
|
||||
process_temporary_deprecated_settings)
|
||||
from freqtrade.configuration.load_config import load_config_file, log_config_error_range
|
||||
from freqtrade.configuration.load_config import load_config_file, load_file, log_config_error_range
|
||||
from freqtrade.constants import DEFAULT_DB_DRYRUN_URL, DEFAULT_DB_PROD_URL
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.loggers import _set_loggers, setup_logging, setup_logging_pre
|
||||
|
@ -101,6 +101,12 @@ def test_load_config_file_error_range(default_conf, mocker, caplog) -> None:
|
|||
assert x == ''
|
||||
|
||||
|
||||
def test_load_file_error(tmpdir):
|
||||
testpath = Path(tmpdir) / 'config.json'
|
||||
with pytest.raises(OperationalException, match=r"File .* not found!"):
|
||||
load_file(testpath)
|
||||
|
||||
|
||||
def test__args_to_config(caplog):
|
||||
|
||||
arg_list = ['trade', '--strategy-path', 'TestTest']
|
||||
|
|
Loading…
Reference in New Issue
Block a user