test: update tests for new --version handling

This commit is contained in:
Matthias
2025-01-24 19:39:34 +01:00
parent 120194ff1e
commit d843216343
2 changed files with 11 additions and 2 deletions

View File

@@ -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:

View File

@@ -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