clan-cli: fix tests
This commit is contained in:
@@ -7,7 +7,7 @@ from . import admin
|
|||||||
has_argcomplete = True
|
has_argcomplete = True
|
||||||
try:
|
try:
|
||||||
import argcomplete
|
import argcomplete
|
||||||
except ImportError:
|
except ImportError: # pragma: no cover
|
||||||
has_argcomplete = False
|
has_argcomplete = False
|
||||||
|
|
||||||
|
|
||||||
@@ -25,5 +25,5 @@ def main() -> None:
|
|||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__": # pragma: no cover
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import clan_cli
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
def test_no_args(capsys: pytest.CaptureFixture) -> None:
|
def test_no_args(capsys: pytest.CaptureFixture, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
|
monkeypatch.setattr(sys, "argv", [""])
|
||||||
clan_cli.main()
|
clan_cli.main()
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert captured.out.startswith("usage:")
|
assert captured.out.startswith("usage:")
|
||||||
|
|||||||
Reference in New Issue
Block a user