Coverage for tests/test_cli.py: 100.00%
24 statements
« prev ^ index » next coverage.py v7.10.0, created at 2025-09-10 18:56 +1000
« prev ^ index » next coverage.py v7.10.0, created at 2025-09-10 18:56 +1000
1"""Tests for the CLI."""
3from __future__ import annotations
5import pytest
7from geosdhydro import main
8from geosdhydro._internal import debug
11def test_main() -> None:
12 """Basic CLI test."""
13 assert main([]) == 0
16def test_show_help(capsys: pytest.CaptureFixture) -> None:
17 """Show help.
19 Parameters:
20 capsys: Pytest fixture to capture output.
21 """
22 with pytest.raises(SystemExit):
23 main(["-h"])
24 captured = capsys.readouterr()
25 assert "geosdhydro" in captured.out
28def test_show_version(capsys: pytest.CaptureFixture) -> None:
29 """Show version.
31 Parameters:
32 capsys: Pytest fixture to capture output.
33 """
34 with pytest.raises(SystemExit):
35 main(["-V"])
36 captured = capsys.readouterr()
37 assert debug._get_version() in captured.out
40def test_show_debug_info(capsys: pytest.CaptureFixture) -> None:
41 """Show debug information.
43 Parameters:
44 capsys: Pytest fixture to capture output.
45 """
46 with pytest.raises(SystemExit):
47 main(["--debug-info"])
48 captured = capsys.readouterr().out.lower()
49 assert "python" in captured
50 assert "system" in captured
51 assert "environment" in captured
52 assert "packages" in captured