From 67b82638dbda9d879987f2012c2d1847c7364c61 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 Sep 2019 06:44:20 +0200 Subject: [PATCH] Move test without command to test_main --- tests/test_arguments.py | 11 ++--------- tests/test_main.py | 8 +++++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/test_arguments.py b/tests/test_arguments.py index 8ea55dd6a..8cd24fe55 100644 --- a/tests/test_arguments.py +++ b/tests/test_arguments.py @@ -4,19 +4,12 @@ import re import pytest +from freqtrade import OperationalException from freqtrade.configuration import Arguments from freqtrade.configuration.cli_options import check_int_positive # Parse common command-line-arguments. Used for all tools -def test_parse_args_error(capsys) -> None: - arguments = Arguments([]) - with pytest.raises(SystemExit): - arguments.get_parsed_arg() - captured = capsys.readouterr() - assert re.search(r".*the following arguments are required.*", captured.err) - - def test_parse_args_none() -> None: arguments = Arguments(['trade']) assert isinstance(arguments, Arguments) @@ -157,8 +150,8 @@ def test_download_data_options() -> None: def test_plot_dataframe_options() -> None: args = [ - '-c', 'config.json.example', 'plot-dataframe', + '-c', 'config.json.example', '--indicators1', 'sma10', 'sma100', '--indicators2', 'macd', 'fastd', 'fastk', '--plot-limit', '30', diff --git a/tests/test_main.py b/tests/test_main.py index c5e1c8901..dac960886 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -11,10 +11,16 @@ from freqtrade.freqtradebot import FreqtradeBot from freqtrade.main import main from freqtrade.state import State from freqtrade.worker import Worker -from tests.conftest import (log_has, patch_exchange, +from tests.conftest import (log_has, log_has_re, patch_exchange, patched_configuration_load_config_file) +def test_parse_args_None(caplog) -> None: + with pytest.raises(SystemExit): + main([]) + assert log_has_re(r"Usage of freqtrade requires a subcommand\.", caplog) + + def test_parse_args_backtesting(mocker) -> None: """ Test that main() can start backtesting and also ensure we can pass some specific arguments