Skip to content

Commit

Permalink
fixed unittest for plain cli
Browse files Browse the repository at this point in the history
  • Loading branch information
nishant-dash committed Dec 14, 2023
1 parent 2ade18d commit da44a01
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion rt/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def main( # pylint: disable=too-many-arguments
:param quiet: Suppress special keyword highlighting
:param rules: Add special highlighting ruels such as openstack, juju, etc...
:param file: Specify a file (file extension matters!)
:raises Exit: 1 if no defining input is provided
"""
stdin_data = sys.stdin
extra_options = {
Expand All @@ -138,7 +139,7 @@ def main( # pylint: disable=too-many-arguments
obj = CsvToRichTable(**extra_options)
else:
console.print("[red]No file nor any one of json, yaml or csv chosen![/red]")
return 1
raise typer.Exit(code=1)
obj.run(stdin_data) # type: ignore[arg-type]
return 0

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ def test_file_cli(fn):
def test_plain_cli():
runner = CliRunner()
result = runner.invoke(cli.cli)
assert result.exit_code == 0
assert result.exit_code == 1
assert "No file nor any one of json, yaml or csv chosen!" in result.stdout

0 comments on commit da44a01

Please sign in to comment.