diff --git a/freqtrade/configuration/load_config.py b/freqtrade/configuration/load_config.py index 1320a375f..27190d259 100644 --- a/freqtrade/configuration/load_config.py +++ b/freqtrade/configuration/load_config.py @@ -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 diff --git a/tests/test_configuration.py b/tests/test_configuration.py index c15a0fe6a..b08d0775c 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -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']