Add no-arg test

pull/2538/head
Matthias 7 years ago
parent b36a1d3260
commit 65489c894d

@ -56,7 +56,7 @@ ARGS_PLOT_PROFIT = ["pairs", "timerange", "export", "exportfilename", "db_url",
NO_CONF_REQURIED = ["download-data", "list-timeframes", "list-markets", "list-pairs",
"plot-dataframe", "plot-profit"]
NO_CONF_ALLOWED = ["create-userdir", "list-exchanges","new-hyperopt", "new-strategy"]
NO_CONF_ALLOWED = ["create-userdir", "list-exchanges", "new-hyperopt", "new-strategy"]
class Arguments:

@ -111,8 +111,7 @@ def start_new_strategy(args: Dict[str, Any]) -> None:
logger.info(f"Writing strategy to `{new_path}`.")
new_path.write_text(strategy_text)
else:
logger.warning("`new-strategy` requires --strategy to be set.")
sys.exit(1)
raise OperationalException("`new-strategy` requires --strategy to be set.")
def start_new_hyperopt(args: Dict[str, Any]) -> None:
@ -135,8 +134,7 @@ def start_new_hyperopt(args: Dict[str, Any]) -> None:
logger.info(f"Writing hyperopt to `{new_path}`.")
new_path.write_text(strategy_text)
else:
logger.warning("`new-hyperopt` requires --hyperopt to be set.")
sys.exit(1)
raise OperationalException("`new-hyperopt` requires --hyperopt to be set.")
def start_download_data(args: Dict[str, Any]) -> None:

@ -469,7 +469,6 @@ def test_start_new_strategy(mocker, caplog):
assert log_has_re("Writing strategy to .*", caplog)
def test_start_new_strategy_DefaultStrat(mocker, caplog):
args = [
"new-strategy",
@ -481,6 +480,15 @@ def test_start_new_strategy_DefaultStrat(mocker, caplog):
start_new_strategy(get_args(args))
def test_start_new_strategy_no_arg(mocker, caplog):
args = [
"new-strategy",
]
with pytest.raises(OperationalException,
match="`new-strategy` requires --strategy to be set."):
start_new_strategy(get_args(args))
def test_download_data_keyboardInterrupt(mocker, caplog, markets):
dl_mock = mocker.patch('freqtrade.utils.refresh_backtest_ohlcv_data',
MagicMock(side_effect=KeyboardInterrupt))

Loading…
Cancel
Save