diff --git a/tests/test_arguments.py b/tests/test_arguments.py index 499b194a2..1d48acb96 100644 --- a/tests/test_arguments.py +++ b/tests/test_arguments.py @@ -82,8 +82,8 @@ def test_common_scripts_options() -> None: def test_parse_args_version() -> None: - with pytest.raises(SystemExit, match=r"0"): - Arguments(["--version"]).get_parsed_arg() + args = Arguments(["--version"]).get_parsed_arg() + assert args["version_main"] is True def test_parse_args_invalid() -> None: diff --git a/tests/test_main.py b/tests/test_main.py index 54b00a7d8..0551def2d 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,5 +1,6 @@ # pragma pylint: disable=missing-docstring +import re from copy import deepcopy from pathlib import Path from unittest.mock import MagicMock, PropertyMock @@ -26,6 +27,14 @@ def test_parse_args_None(caplog) -> None: assert log_has_re(r"Usage of Freqtrade requires a subcommand.*", caplog) +def test_parse_args_version(capsys) -> None: + with pytest.raises(SystemExit): + main(["-V"]) + captured = capsys.readouterr() + assert re.search(r"CCXT Version:\s.*", captured.out, re.MULTILINE) + assert re.search(r"Freqtrade Version:\s+freqtrade\s.*", captured.out, re.MULTILINE) + + def test_parse_args_backtesting(mocker) -> None: """ Test that main() can start backtesting and also ensure we can pass some specific arguments