Skip to content

Commit

Permalink
Added basic test for CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
joernweissenborn authored and jsnel committed Aug 12, 2021
1 parent e21e127 commit 151dd81
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions glotaran/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from glotaran.cli.main import glotaran
3 changes: 3 additions & 0 deletions glotaran/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@


class Cli(click.Group):
"""The glotaran CLI implementation of :class:`click.group`"""

def __init__(self, *args, **kwargs):
self.help_priorities = {}
super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -44,6 +46,7 @@ def decorator(f):
@click.group(cls=Cli)
@click.version_option(version=gta.__version__)
def glotaran():
"""The glotaran CLI main function."""
pass


Expand Down
16 changes: 16 additions & 0 deletions glotaran/cli/test/test_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from click.testing import CliRunner

from glotaran import cli


def test_command_line_interface():
"""Test the CLI."""
runner = CliRunner()
result = runner.invoke(cli.glotaran)
assert result.exit_code == 0
help_result = runner.invoke(cli.glotaran, ["--help"])
assert help_result.exit_code == 0
assert "Usage: glotaran [OPTIONS] COMMAND [ARGS]..." in help_result.output
plugin_result = runner.invoke(cli.glotaran, ["pluginlist"])
assert plugin_result.exit_code == 0
assert "Installed Glotaran Plugins" in plugin_result.output

0 comments on commit 151dd81

Please sign in to comment.