Skip to content

Commit d843216

Browse files
committed
test: update tests for new --version handling
1 parent 120194f commit d843216

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

tests/test_arguments.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def test_common_scripts_options() -> None:
8282

8383

8484
def test_parse_args_version() -> None:
85-
with pytest.raises(SystemExit, match=r"0"):
86-
Arguments(["--version"]).get_parsed_arg()
85+
args = Arguments(["--version"]).get_parsed_arg()
86+
assert args["version_main"] is True
8787

8888

8989
def test_parse_args_invalid() -> None:

tests/test_main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# pragma pylint: disable=missing-docstring
22

3+
import re
34
from copy import deepcopy
45
from pathlib import Path
56
from unittest.mock import MagicMock, PropertyMock
@@ -26,6 +27,14 @@ def test_parse_args_None(caplog) -> None:
2627
assert log_has_re(r"Usage of Freqtrade requires a subcommand.*", caplog)
2728

2829

30+
def test_parse_args_version(capsys) -> None:
31+
with pytest.raises(SystemExit):
32+
main(["-V"])
33+
captured = capsys.readouterr()
34+
assert re.search(r"CCXT Version:\s.*", captured.out, re.MULTILINE)
35+
assert re.search(r"Freqtrade Version:\s+freqtrade\s.*", captured.out, re.MULTILINE)
36+
37+
2938
def test_parse_args_backtesting(mocker) -> None:
3039
"""
3140
Test that main() can start backtesting and also ensure we can pass some specific arguments

0 commit comments

Comments
 (0)