Coverage for tests/test_cli.py: 100.00%
23 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-03-19 20:21 +0100
« prev ^ index » next coverage.py v7.4.4, created at 2024-03-19 20:21 +0100
1"""Tests for the `cli` module."""
3from __future__ import annotations
5import pytest
7from devboard import cli, debug
10def test_main() -> None:
11 """Basic CLI test."""
12 assert cli.main([]) == 0
15def test_show_help(capsys: pytest.CaptureFixture) -> None:
16 """Show help.
18 Parameters:
19 capsys: Pytest fixture to capture output.
20 """
21 with pytest.raises(SystemExit):
22 cli.main(["-h"])
23 captured = capsys.readouterr()
24 assert "devboard" in captured.out
27def test_show_version(capsys: pytest.CaptureFixture) -> None:
28 """Show version.
30 Parameters:
31 capsys: Pytest fixture to capture output.
32 """
33 with pytest.raises(SystemExit):
34 cli.main(["-V"])
35 captured = capsys.readouterr()
36 assert debug.get_version() in captured.out
39def test_show_debug_info(capsys: pytest.CaptureFixture) -> None:
40 """Show debug information.
42 Parameters:
43 capsys: Pytest fixture to capture output.
44 """
45 with pytest.raises(SystemExit):
46 cli.main(["--debug-info"])
47 captured = capsys.readouterr().out.lower()
48 assert "python" in captured
49 assert "system" in captured
50 assert "environment" in captured
51 assert "packages" in captured